musl-tcc/src/string/wcsdup.c

11 lines
196 B
C
Raw Permalink Normal View History

2022-03-20 08:48:53 +00:00
#include <stdlib.h>
#include <wchar.h>
wchar_t *wcsdup(const wchar_t *s)
{
size_t l = wcslen(s);
wchar_t *d = malloc((l+1)*sizeof(wchar_t));
if (!d) return NULL;
return wmemcpy(d, s, l+1);
}