projects
/
oweals
/
musl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
only use memcpy realloc to shrink if an exact-sized free chunk exists
[oweals/musl.git]
/
src
/
string
/
wmemmove.c
1
#include <wchar.h>
2
#include <stdint.h>
3
4
wchar_t *wmemmove(wchar_t *d, const wchar_t *s, size_t n)
5
{
6
wchar_t *d0 = d;
7
if (d == s) return d;
8
if ((uintptr_t)d-(uintptr_t)s < n * sizeof *d)
9
while (n--) d[n] = s[n];
10
else
11
while (n--) *d++ = *s++;
12
return d0;
13
}