diff options
author | Luke Leighton <lkcl@samba.org> | 1999-11-03 20:01:07 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-11-03 20:01:07 +0000 |
commit | 59a7e6cef89a9bd519df64978f8c8f113d66d0ef (patch) | |
tree | 5aafef100535a208c1d37cf53335a41065ac0e67 /source3/lib | |
parent | c015b02b43fa0d7743eb555fdf50fc433dc67b98 (diff) | |
download | samba-59a7e6cef89a9bd519df64978f8c8f113d66d0ef.tar.gz samba-59a7e6cef89a9bd519df64978f8c8f113d66d0ef.tar.bz2 samba-59a7e6cef89a9bd519df64978f8c8f113d66d0ef.zip |
had to move unistr2_dup(), unistr2_free() and unistr2_copy() into
util_unistr.c in order to get bin/testparm to compile.
(This used to be commit e718ce9c4a3598483e38b8c32bdf2924593edc1e)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util_unistr.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index e1a2e26623..9078a4fbc6 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -261,3 +261,37 @@ void buffer4_to_str(char *dest, const BUFFER4 *str, size_t maxlen) *dest = 0; } + +/******************************************************************* +copies a UNISTR2 structure. +********************************************************************/ +BOOL copy_unistr2(UNISTR2 *str, const UNISTR2 *from) +{ + /* set up string lengths. add one if string is not null-terminated */ + str->uni_max_len = from->uni_max_len; + str->undoc = from->undoc; + str->uni_str_len = from->uni_str_len; + + /* copy the string */ + memcpy(str->buffer, from->buffer, sizeof(from->buffer)); + + return True; +} + +/******************************************************************* +duplicates a UNISTR2 structure. +********************************************************************/ +UNISTR2 *unistr2_dup(const UNISTR2 *name) +{ + UNISTR2 *copy = (UNISTR2*)malloc(sizeof(*copy)); + copy_unistr2(copy, name); + return copy; +} + +/******************************************************************* +frees a UNISTR2 structure. +********************************************************************/ +void unistr2_free(UNISTR2 *name) +{ + free(name); +} |