Browse Source

fix wrong return value from wmemmove on forward copies

Rich Felker 12 years ago
parent
commit
330fd96213
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/string/wmemmove.c

+ 2 - 1
src/string/wmemmove.c

@@ -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;
 }