Staging
v0.8.1
https://github.com/python/cpython
Revision 739281148d33f69ea51a97b92406c9b043d739d5 authored by Matthias Klose on 03 April 2006, 16:59:32 UTC, committed by Matthias Klose on 03 April 2006, 16:59:32 UTC
1 parent 353aa87
Raw File
Tip revision: 739281148d33f69ea51a97b92406c9b043d739d5 authored by Matthias Klose on 03 April 2006, 16:59:32 UTC
- add missing chunk for patch #1117961
Tip revision: 7392811
memmove.c

/* A perhaps slow but I hope correct implementation of memmove */

extern char *memcpy(char *, char *, int);

char *
memmove(char *dst, char *src, int n)
{
	char *realdst = dst;
	if (n <= 0)
		return dst;
	if (src >= dst+n || dst >= src+n)
		return memcpy(dst, src, n);
	if (src > dst) {
		while (--n >= 0)
			*dst++ = *src++;
	}
	else if (src < dst) {
		src += n;
		dst += n;
		while (--n >= 0)
			*--dst = *--src;
	}
	return realdst;
}
back to top