diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-05-30 16:16:08 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-05-31 00:32:08 +0200 |
commit | 3b7e1ac31c764fc2023925288783c868eb6ec31e (patch) | |
tree | 40a16bb22a65b7df024b612331e8b6621f1de58a /source3/lib/substitute.c | |
parent | a5a2373979a9484bb68271e9c1c518f05a8ec564 (diff) | |
download | samba-3b7e1ac31c764fc2023925288783c868eb6ec31e.tar.gz samba-3b7e1ac31c764fc2023925288783c868eb6ec31e.tar.bz2 samba-3b7e1ac31c764fc2023925288783c868eb6ec31e.zip |
s3-lib Move realloc based string substitution functions out of util_str.c
This makes the dependency set for source3/lib/util_str.c simpiler,
which in turn makes it easier to build a dependency tree.
Andrew Bartlett
Diffstat (limited to 'source3/lib/substitute.c')
-rw-r--r-- | source3/lib/substitute.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index b246a17132..d98a18ae2e 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -926,3 +926,32 @@ char *standard_sub_conn(TALLOC_CTX *ctx, connection_struct *conn, const char *st "", str); } + +/****************************************************************************** + version of standard_sub_basic() for string lists; uses talloc_sub_basic() + for the work + *****************************************************************************/ + +bool str_list_sub_basic( char **list, const char *smb_name, + const char *domain_name ) +{ + TALLOC_CTX *ctx = list; + char *s, *tmpstr; + + while ( *list ) { + s = *list; + tmpstr = talloc_sub_basic(ctx, smb_name, domain_name, s); + if ( !tmpstr ) { + DEBUG(0,("str_list_sub_basic: " + "alloc_sub_basic() return NULL!\n")); + return false; + } + + TALLOC_FREE(*list); + *list = tmpstr; + + list++; + } + + return true; +} |