r1758: Move and enhance the add_string_to_array function as per volker job on trunk
authorSimo Sorce <idra@samba.org>
Thu, 12 Aug 2004 06:30:03 +0000 (06:30 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:57:54 +0000 (12:57 -0500)
(This used to be commit 606caddeb95382287fa41a5017ca473d0301be6b)

source4/lib/util_str.c
source4/torture/rpc/samr.c

index 66acc0ca0e5effef118c3a458d6ee212994b454b..fd13f8650197accb5aca8baac0240892067b4b7c 100644 (file)
@@ -1446,3 +1446,21 @@ const char *str_format_nbt_domain(TALLOC_CTX *mem_ctx, const char *s)
 
        return ret;
 }
+
+BOOL add_string_to_array(TALLOC_CTX *mem_ctx,
+                        const char *str, const char ***strings, int *num)
+{
+       char *dup_str = talloc_strdup(mem_ctx, str);
+
+       *strings = talloc_realloc(mem_ctx, *strings,
+                                 ((*num)+1) * sizeof(**strings));
+
+       if ((*strings == NULL) || (dup_str == NULL))
+               return False;
+
+       (*strings)[*num] = dup_str;
+       *num += 1;
+
+       return True;
+}
+
index c73672689ea1e363fea32000c00baf33a04d770c..1a48aaa9449fdaff5ac1ab461da72a5c19225e9b 100644 (file)
@@ -2315,21 +2315,6 @@ static BOOL test_QueryDomainInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        return True;    
 }
 
-void add_string_to_array(TALLOC_CTX *mem_ctx,
-                        const char *str, const char ***strings, int *num)
-{
-       *strings = talloc_realloc(mem_ctx, *strings,
-                                 ((*num)+1) * sizeof(**strings));
-
-       if (*strings == NULL)
-               return;
-
-       (*strings)[*num] = str;
-       *num += 1;
-
-       return;
-}
-
 /* Test whether querydispinfo level 5 and enumdomgroups return the same
    set of group names. */
 static BOOL test_GroupList(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,