1 /* $NetBSD: wcsdup.c,v 1.2 2006/08/26 22:45:52 christos Exp $ */
4 * Copyright (C) 2006 Aleksey Cheusov
6 * This material is provided "as is", with absolutely no warranty expressed
7 * or implied. Any use is at your own risk.
9 * Permission to use or copy this software for any purpose is hereby granted
10 * without fee. Permission to modify the code and to distribute modified
11 * code is also granted without any restrictions.
14 #include <sys/cdefs.h>
16 #if defined(LIBC_SCCS) && !defined(lint)
17 __RCSID("$NetBSD: wcsdup.c,v 1.2 2006/08/26 22:45:52 christos Exp $");
18 #endif /* LIBC_SCCS and not lint */
20 #include "namespace.h"
25 __weak_alias(wcsdup
,_wcsdup
)
28 wcsdup(const wchar_t *str
)
33 _DIAGASSERT(str
!= NULL
);
35 len
= wcslen(str
) + 1;
36 copy
= malloc(len
* sizeof (wchar_t));
41 return wmemcpy(copy
, str
, len
);