X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=inline;f=src%2Fstring%2Fmemmove.c;h=9153a64476a97a64bfc1e0614276f91e18ebea73;hb=594318fd3d13c7dda1ea87a76934e052ac74301f;hp=22bb4b3559d3e76a8f064028925352f78a735ab8;hpb=fcfba99503746e44585d7e318562dd425e8ff390;p=musl diff --git a/src/string/memmove.c b/src/string/memmove.c index 22bb4b35..9153a644 100644 --- a/src/string/memmove.c +++ b/src/string/memmove.c @@ -5,10 +5,9 @@ void *memmove(void *dest, const void *src, size_t n) char *d = dest; const char *s = src; if (d==s) return d; - if ((size_t)(d-s) < n) { + if ((size_t)(d-s) < n) while (n--) d[n] = s[n]; - return dest; - } - /* Assumes memcpy is overlap-safe when dest < src */ - return memcpy(d, s, n); + else + while (n--) *d++ = *s++; + return dest; }