source:
trunk/essentials/dev-lang/python/Python/memmove.c@
3296
| Last change on this file since 3296 was 3225, checked in by , 19 years ago | |
|---|---|
| File size: 439 bytes | |
| Line | |
|---|---|
| 1 | |
| 2 | /* A perhaps slow but I hope correct implementation of memmove */ |
| 3 | |
| 4 | extern char *memcpy(char *, char *, int); |
| 5 | |
| 6 | char * |
| 7 | memmove(char *dst, char *src, int n) |
| 8 | { |
| 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) { |
