somake/comp/wcsdup.c
Georg Sauthoff d648e92188 fix build on Solaris 10
Solaris 10 is too old for POSIX.2008, thus wcsdup() is missing
2016-08-23 21:13:46 +02:00

17 lines
334 B
C

// 2016, Georg Sauthoff <mail@georg.so>, CDDL and WTFPL
#include "wcsdup.h"
#ifndef HAVE_WCSDUP
#include <stdlib.h>
// this function is part of POSIX.2008
wchar_t * wcsdup(const wchar_t *s)
{
size_t n = wcslen(s) + 1;
wchar_t r = malloc(n * sizeof(wchar_t));
return r ? return wmemcpy(r, s, n) : 0;
}
#endif