wcsdup.c 196 B

12345678910
  1. #include <stdlib.h>
  2. #include <wchar.h>
  3. wchar_t *wcsdup(const wchar_t *s)
  4. {
  5. size_t l = wcslen(s);
  6. wchar_t *d = malloc((l+1)*sizeof(wchar_t));
  7. if (!d) return NULL;
  8. return wmemcpy(d, s, l+1);
  9. }