summaryrefslogtreecommitdiffstats
path: root/source/rpc_parse
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-11-03 19:58:47 +0000
committerLuke Leighton <lkcl@samba.org>1999-11-03 19:58:47 +0000
commita80ea2eb47d298095eb6e5b0455309daa3a631cb (patch)
tree14b33edbf4c143d13b9486622957c45b2d85ca11 /source/rpc_parse
parent0c700fb609adf80cb3191f2976c6d56088d81232 (diff)
downloadsamba-a80ea2eb47d298095eb6e5b0455309daa3a631cb.tar.gz
samba-a80ea2eb47d298095eb6e5b0455309daa3a631cb.tar.xz
samba-a80ea2eb47d298095eb6e5b0455309daa3a631cb.zip
three types of array-creation / array-deletion functions:
char* UNISTR2* SID* decided to create a higher-order function set, add_item_to_array() free_item_array(). higher-order support routines needed to add a new type: type* item_dup(const type*) void item_free(type*) of course, strdup() and free() are perfect, pre-existing examples of such functions, used in the implementation of add_chars_to_array() and free_char_array(). sid_dup() and free() work for the add_sids_to_array() and free_sid_array() implementations. use unistr2_dup() and created unistr2_free() because the functionality behind these may change into something horrible, like [horror] dynamic memory allocation of the UNISTR2 character array. argh!!!! jean-francois, this function set implements what we talked about over... a year ago, now :-)
Diffstat (limited to 'source/rpc_parse')
-rw-r--r--source/rpc_parse/parse_misc.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/source/rpc_parse/parse_misc.c b/source/rpc_parse/parse_misc.c
index 69455b7b429..471cb59e1c5 100644
--- a/source/rpc_parse/parse_misc.c
+++ b/source/rpc_parse/parse_misc.c
@@ -747,7 +747,7 @@ BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf)
/*******************************************************************
copies a UNISTR2 structure.
********************************************************************/
-BOOL copy_unistr2(UNISTR2 *str, UNISTR2 *from)
+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;
@@ -761,6 +761,24 @@ BOOL copy_unistr2(UNISTR2 *str, UNISTR2 *from)
}
/*******************************************************************
+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);
+}
+
+/*******************************************************************
creates a STRING2 structure.
********************************************************************/
BOOL make_string2(STRING2 *str, char *buf, int len)