3 <<wcsdup>>---wide character string duplicate
12 wchar_t *wcsdup(const wchar_t *<[str]>);
15 wchar_t *_wcsdup_r(struct _reent *<[ptr]>, const wchar_t *<[str]>);
18 <<wcsdup>> allocates a new wide character string using <<malloc>>,
19 and copies the content of the argument <[str]> into the newly
20 allocated string, thus making a copy of <[str]>.
23 <<wcsdup>> returns a pointer to the copy of <[str]> if enough
24 memory for the copy was available. Otherwise it returns NULL
25 and errno is set to ENOMEM.
39 _wcsdup_r (struct _reent
*p
, const wchar_t *str
)
41 size_t len
= wcslen (str
) + 1;
42 wchar_t *copy
= _malloc_r (p
, len
* sizeof (wchar_t));
44 wmemcpy (copy
, str
, len
);
51 wcsdup (const wchar_t *str
)
53 return _wcsdup_r (_REENT
, str
);
56 #endif /* !_REENT_ONLY */