From 5b3096a32fff88cb5f5388402f327da7b3d3dc18 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 22 Dec 1999 18:46:05 +0000 Subject: include/includes.h: Trimmed down unicode directory entry to be POSIX complient. lib/system.c: Trimmed down unicode directory entry to be POSIX complient. lib/util_unistr.c: Added wstrdup(). Jeremy. (This used to be commit ca64f4ab00c6d54022ba9bd4b869523566a242d7) --- source3/lib/util_unistr.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source3/lib/util_unistr.c') diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index 00f6ba4897..cdeaefce7a 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -891,3 +891,17 @@ smb_ucs2_t *wstrtok(smb_ucs2_t *s1, const smb_ucs2_t *s2) return NULL; } + +/******************************************************************* + Duplicate a ucs2 string. +********************************************************************/ + +smb_ucs2_t *wstrdup(const smb_ucs2_t *s) +{ + size_t newlen = (wstrlen(s)*sizeof(smb_ucs2_t)) + 1; + smb_ucs2_t *newstr = (smb_ucs2_t *)malloc(newlen); + if (newstr == NULL) + return NULL; + safe_wstrcpy(newstr, s, newlen); + return newstr; +} -- cgit