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 89041c32ae28ad29847ed720a9b75944e85b7c80..cde4feec920d2c0f99d5b28578889bd8410abb27 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;
 }