diff options
author | Garming Sam <garming@catalyst.net.nz> | 2014-02-24 17:33:57 +1300 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-05-07 19:49:16 +0200 |
commit | 98dbc38efa26149442a0b9be238cc34cebfd1857 (patch) | |
tree | 7c1010c83a1e5e37890693506f0af71310de4d27 /source3/lib/util_str.c | |
parent | f4d7f12986057cc35cf4ca60f6dc8ec7611e0c31 (diff) | |
download | samba-98dbc38efa26149442a0b9be238cc34cebfd1857.tar.gz samba-98dbc38efa26149442a0b9be238cc34cebfd1857.tar.xz samba-98dbc38efa26149442a0b9be238cc34cebfd1857.zip |
move str_list_make_v3 out of s3 code
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/lib/util_str.c')
-rw-r--r-- | source3/lib/util_str.c | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 908f23aaa9d..cfc495d6702 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -1227,74 +1227,6 @@ char *escape_shell_string(const char *src) return ret; } -/*************************************************** - str_list_make, v3 version. The v4 version does not - look at quoted strings with embedded blanks, so - do NOT merge this function please! -***************************************************/ - -#define S_LIST_ABS 16 /* List Allocation Block Size */ - -char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, - const char *sep) -{ - char **list; - const char *str; - char *s, *tok; - int num, lsize; - - if (!string || !*string) - return NULL; - - list = talloc_array(mem_ctx, char *, S_LIST_ABS+1); - if (list == NULL) { - return NULL; - } - lsize = S_LIST_ABS; - - s = talloc_strdup(list, string); - if (s == NULL) { - DEBUG(0,("str_list_make: Unable to allocate memory")); - TALLOC_FREE(list); - return NULL; - } - if (!sep) sep = LIST_SEP; - - num = 0; - str = s; - - while (next_token_talloc(list, &str, &tok, sep)) { - - if (num == lsize) { - char **tmp; - - lsize += S_LIST_ABS; - - tmp = talloc_realloc(mem_ctx, list, char *, - lsize + 1); - if (tmp == NULL) { - DEBUG(0,("str_list_make: " - "Unable to allocate memory")); - TALLOC_FREE(list); - return NULL; - } - - list = tmp; - - memset (&list[num], 0, - ((sizeof(char*)) * (S_LIST_ABS +1))); - } - - list[num] = tok; - num += 1; - } - - list[num] = NULL; - - TALLOC_FREE(s); - return list; -} - /* * This routine improves performance for operations temporarily acting on a * full path. It is equivalent to the much more expensive |