X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmemmove.c;h=d070796fdbb4b470c822c7cfd0f13bf9b811e545;hb=7b7f6d343eb133e6fb670a982ef4b6b3e13256cb;hp=7031ff24cf131fa477b4524cbc21a58c4530f35d;hpb=0f5b2141ada6dd76e37ca4182db81af0f262b455;p=gnulib.git diff --git a/lib/memmove.c b/lib/memmove.c index 7031ff24c..d070796fd 100644 --- a/lib/memmove.c +++ b/lib/memmove.c @@ -3,18 +3,26 @@ In the public domain. By David MacKenzie . */ -void +#ifdef HAVE_CONFIG_H +# include +#endif + +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; }