diff options
author | Garming Sam <garming@catalyst.net.nz> | 2014-02-27 12:14:57 +1300 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-05-07 19:49:14 +0200 |
commit | 2dd7c890792cf12049ec13b88aa4e9de23035f9d (patch) | |
tree | 54404344af6b9aa21b2468afc069fa4d835764bb /source3 | |
parent | a81279c8e0fd6b31646d5725ee0ca35684f7bb81 (diff) | |
download | samba-2dd7c890792cf12049ec13b88aa4e9de23035f9d.tar.gz samba-2dd7c890792cf12049ec13b88aa4e9de23035f9d.tar.xz samba-2dd7c890792cf12049ec13b88aa4e9de23035f9d.zip |
param: remove string_init and inline it into string_set
In making this change, the special case has been removed for empty strings.
The use of empty strings causes various issues with trying to mix s4 and s3 code.
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-on: https://gerrit.samba.org/156
Reviewed-by: Kamen Mazdrashki <kamenim@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/param/loadparm.c | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index a47d5ce545..fbfdb06d72 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -291,31 +291,6 @@ static void free_param_opts(struct parmlist_entry **popts); static const char null_string[] = ""; /** - Set a string value, allocing the space for the string -**/ - -static bool string_init(TALLOC_CTX *mem_ctx, char **dest,const char *src) -{ - size_t l; - - if (!src) - src = ""; - - l = strlen(src); - - if (l == 0) { - *dest = discard_const_p(char, null_string); - } else { - (*dest) = talloc_strdup(mem_ctx, src); - if ((*dest) == NULL) { - DEBUG(0,("Out of memory in string_init\n")); - return false; - } - } - return(true); -} - -/** Free a string value. **/ @@ -336,7 +311,18 @@ static void string_free(char **s) static bool string_set(TALLOC_CTX *mem_ctx, char **dest,const char *src) { string_free(dest); - return(string_init(mem_ctx, dest, src)); + + if (!src) { + src = ""; + } + + (*dest) = talloc_strdup(mem_ctx, src); + if ((*dest) == NULL) { + DEBUG(0,("Out of memory in string_init\n")); + return false; + } + + return true; } /*************************************************************************** |