diff options
author | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-09-24 23:50:05 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-09-24 23:58:19 +0200 |
commit | 918b5a7e057bd91289ec06b3ef8d95da43a50ede (patch) | |
tree | 1c689e510d5f0f80ded8339a859abc4b3ecee30e | |
parent | 506b0b6435ee86d58b4f92b91f1f2b0c498da3fd (diff) | |
download | samba-918b5a7e057bd91289ec06b3ef8d95da43a50ede.tar.gz samba-918b5a7e057bd91289ec06b3ef8d95da43a50ede.tar.bz2 samba-918b5a7e057bd91289ec06b3ef8d95da43a50ede.zip |
s3:util_str "str_list_make_v3" - introduce also here the "const" result
I did this to match with the default util strlist library.
-rw-r--r-- | source3/include/proto.h | 2 | ||||
-rw-r--r-- | source3/lib/util_str.c | 18 |
2 files changed, 10 insertions, 10 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index d664a26949..e17486b7fc 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1563,7 +1563,7 @@ bool validate_net_name( const char *name, const char *invalid_chars, int max_len); char *escape_shell_string(const char *src); -char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep); +const char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep); /* The following definitions come from lib/util_unistr.c */ diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index c197fd7515..2136388eb4 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -1616,7 +1616,7 @@ bool str_list_sub_basic( char **list, const char *smb_name, } /****************************************************************************** - substritute a specific pattern in a string list + substitute a specific pattern in a string list *****************************************************************************/ bool str_list_substitute(char **list, const char *pattern, const char *insert) @@ -2430,18 +2430,18 @@ char *escape_shell_string(const char *src) #define S_LIST_ABS 16 /* List Allocation Block Size */ -char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep) +const char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, + const char *sep) { - char **list; + const char **list; const char *str; - char *s; + char *s, *tok; int num, lsize; - char *tok; if (!string || !*string) return NULL; - list = TALLOC_ARRAY(mem_ctx, char *, S_LIST_ABS+1); + list = TALLOC_ARRAY(mem_ctx, const char *, S_LIST_ABS+1); if (list == NULL) { return NULL; } @@ -2461,11 +2461,11 @@ char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep while (next_token_talloc(list, &str, &tok, sep)) { if (num == lsize) { - char **tmp; + const char **tmp; lsize += S_LIST_ABS; - tmp = TALLOC_REALLOC_ARRAY(mem_ctx, list, char *, + tmp = TALLOC_REALLOC_ARRAY(mem_ctx, list, const char *, lsize + 1); if (tmp == NULL) { DEBUG(0,("str_list_make: " @@ -2477,7 +2477,7 @@ char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep list = tmp; memset (&list[num], 0, - ((sizeof(char**)) * (S_LIST_ABS +1))); + ((sizeof(const char**)) * (S_LIST_ABS +1))); } list[num] = tok; |