200 |
/* To cope with SunOS4 and other systems that lack memmove() but have bcopy(), |
/* To cope with SunOS4 and other systems that lack memmove() but have bcopy(), |
201 |
define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY |
define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY |
202 |
is set. Otherwise, include an emulating function for those systems that have |
is set. Otherwise, include an emulating function for those systems that have |
203 |
neither (there some non-Unix environments where this is the case). This assumes |
neither (there some non-Unix environments where this is the case). */ |
|
that all calls to memmove are moving strings upwards in store, which is the |
|
|
case in PCRE. */ |
|
204 |
|
|
205 |
#if ! HAVE_MEMMOVE |
#if ! HAVE_MEMMOVE |
206 |
#undef memmove /* some systems may have a macro */ |
#undef memmove /* some systems may have a macro */ |
213 |
size_t i; |
size_t i; |
214 |
unsigned char *dest = (unsigned char *)d; |
unsigned char *dest = (unsigned char *)d; |
215 |
const unsigned char *src = (const unsigned char *)s; |
const unsigned char *src = (const unsigned char *)s; |
216 |
dest += n; |
if (dest > src) |
217 |
src += n; |
{ |
218 |
for (i = 0; i < n; ++i) *(--dest) = *(--src); |
dest += n; |
219 |
return (void *)dest; |
src += n; |
220 |
|
for (i = 0; i < n; ++i) *(--dest) = *(--src); |
221 |
|
return (void *)dest; |
222 |
|
} |
223 |
|
else |
224 |
|
{ |
225 |
|
for (i = 0; i < n; ++i) *dest++ = *src++; |
226 |
|
return (void *)(dest - n); |
227 |
|
} |
228 |
} |
} |
229 |
#define memmove(a, b, c) pcre_memmove(a, b, c) |
#define memmove(a, b, c) pcre_memmove(a, b, c) |
230 |
#endif /* not HAVE_BCOPY */ |
#endif /* not HAVE_BCOPY */ |