fix wrong return value from wmemmove on forward copies
authorRich Felker <dalias@aerifal.cx>
Fri, 22 Feb 2013 04:19:18 +0000 (23:19 -0500)
committerRich Felker <dalias@aerifal.cx>
Fri, 22 Feb 2013 04:19:18 +0000 (23:19 -0500)
src/string/wmemmove.c

index 89041c3..cde4fee 100644 (file)
@@ -3,9 +3,10 @@
 
 wchar_t *wmemmove(wchar_t *d, const wchar_t *s, size_t n)
 {
+       wchar_t *d0 = d;
        if ((size_t)(d-s) < n)
                while (n--) d[n] = s[n];
        else
                while (n--) *d++ = *s++;
-       return d;
+       return d0;
 }