'Other changes' section now has only one item; move the item elsewhere and remove...
[pytest.git] / Python / memmove.c
blob6fb0dad934d198586ab19c7b7a12964b76bc1ecb
2 /* A perhaps slow but I hope correct implementation of memmove */
4 extern char *memcpy(char *, char *, int);
6 char *
7 memmove(char *dst, char *src, int n)
9 char *realdst = dst;
10 if (n <= 0)
11 return dst;
12 if (src >= dst+n || dst >= src+n)
13 return memcpy(dst, src, n);
14 if (src > dst) {
15 while (--n >= 0)
16 *dst++ = *src++;
18 else if (src < dst) {
19 src += n;
20 dst += n;
21 while (--n >= 0)
22 *--dst = *--src;
24 return realdst;