summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-04-07 16:33:26 +1000
committerAndrew Tridgell <tridge@samba.org>2009-04-07 16:33:26 +1000
commitef6c6ab4c6cee26ea84c2e2a0041ad62f428ad01 (patch)
treea96db028bec0896122eadc3c606ec67831179bfa
parent6e6094d780d372d0bc6cdf3bbdab360b5cd61219 (diff)
downloadsamba-ef6c6ab4c6cee26ea84c2e2a0041ad62f428ad01.tar.gz
samba-ef6c6ab4c6cee26ea84c2e2a0041ad62f428ad01.tar.bz2
samba-ef6c6ab4c6cee26ea84c2e2a0041ad62f428ad01.zip
added a str_list_append() function
-rw-r--r--lib/util/util_strlist.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/util/util_strlist.c b/lib/util/util_strlist.c
index b069a11e38..c53fee8f82 100644
--- a/lib/util/util_strlist.c
+++ b/lib/util/util_strlist.c
@@ -308,3 +308,26 @@ _PUBLIC_ bool str_list_check_ci(const char **list, const char *s)
}
+/**
+ append one list to another - expanding list1
+*/
+_PUBLIC_ const char **str_list_append(const char **list1, const char **list2)
+{
+ size_t len1 = str_list_length(list1);
+ size_t len2 = str_list_length(list2);
+ const char **ret;
+ int i;
+
+ ret = talloc_realloc(NULL, list1, const char *, len1+len2+1);
+ if (ret == NULL) return NULL;
+
+ for (i=len1;i<len1+len2;i++) {
+ ret[i] = talloc_strdup(ret, list2[i-len1]);
+ if (ret[i] == NULL) {
+ return NULL;
+ }
+ }
+ ret[i] = NULL;
+
+ return ret;
+}