X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmemmove.c;h=ea38e8df549e9e1210c0a38bbe8ed08e45a93603;hb=4028e63dd21b964fdcd76448c973cbad683982e4;hp=d7bdd7cd99503b51ebe37eb7d45d778a8954e8d3;hpb=9b8ea95435bc2ccb0882039535ccd5fac84dc935;p=gnulib.git diff --git a/lib/memmove.c b/lib/memmove.c index d7bdd7cd9..ea38e8df5 100644 --- a/lib/memmove.c +++ b/lib/memmove.c @@ -3,22 +3,26 @@ In the public domain. By David MacKenzie . */ -#ifdef HAVE_CONFIG_H -#include +#if HAVE_CONFIG_H +# include #endif -void +void * memmove (dest, source, length) 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; }