X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmemmove.c;h=ea38e8df549e9e1210c0a38bbe8ed08e45a93603;hb=de1b0c616f4497865334c973236206a7d391fd23;hp=d9d9e077ea42814aade747895eb05687d628e0f1;hpb=e2079963e22e13e02c81eaffce885a0985a03a83;p=gnulib.git diff --git a/lib/memmove.c b/lib/memmove.c index d9d9e077e..ea38e8df5 100644 --- a/lib/memmove.c +++ b/lib/memmove.c @@ -3,17 +3,26 @@ In the public domain. By David MacKenzie . */ -void +#if HAVE_CONFIG_H +# include +#endif + +void * memmove (dest, source, length) - char *dest, *source; + char *dest; + const char *source; unsigned length; { + char *d0 = dest; if (source < dest) /* Moving from low mem to hi mem; start at end. */ for (source += length, dest += length; length; --length) *--dest = *--source; else if (source != dest) - /* Moving from hi mem to low mem; start at beginning. */ - for (; length; --length) - *dest++ = *source++; + { + /* Moving from hi mem to low mem; start at beginning. */ + for (; length; --length) + *dest++ = *source++; + } + return (void *) d0; }