summaryrefslogtreecommitdiffstats
path: root/source/lib/util_str.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/lib/util_str.c')
-rw-r--r--source/lib/util_str.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/lib/util_str.c b/source/lib/util_str.c
index 6ebada94d71..6b6581b4a7b 100644
--- a/source/lib/util_str.c
+++ b/source/lib/util_str.c
@@ -2092,3 +2092,19 @@ void string_append(char **left, const char *right)
safe_strcat(*left, right, new_len-1);
}
+
+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_ARRAY(mem_ctx, *strings, const char *, (*num)+1);
+
+ if ((*strings == NULL) || (dup_str == NULL))
+ return False;
+
+ (*strings)[*num] = dup_str;
+ *num += 1;
+ return True;
+}