1 /* $NetBSD: wcsdup.c,v 1.3 2008/05/26 13:17:48 haad 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.
18 #if defined(LIBC_SCCS) && !defined(lint)
19 __RCSID("$NetBSD: wcsdup.c,v 1.3 2008/05/26 13:17:48 haad Exp $");
20 #endif /* LIBC_SCCS and not lint */
27 wcsdup(const wchar_t *str
)
32 _DIAGASSERT(str
!= NULL
);
34 len
= wcslen(str
) + 1;
35 copy
= malloc(len
* sizeof (wchar_t));
40 return wmemcpy(copy
, str
, len
);