aboutsummaryrefslogtreecommitdiffstats
path: root/memory/wcsdup.c
blob: ee11c464b4315351d9311275df6adb1175723685 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
#include "memory.h"

wchar_t *wcsdup(wchar_t const *restrict string)
{
	size_t lenght = wcslen(string) + 1;
	wchar_t *duplicate = reallocarray(NULL, lenght, sizeof *duplicate);
	if (duplicate != NULL)
		wmemcpy(duplicate, string, lenght);
	return duplicate;
}