From 3b7e1ac31c764fc2023925288783c868eb6ec31e Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 30 May 2011 16:16:08 +1000 Subject: 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 --- source3/lib/substitute.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'source3/lib/substitute.c') 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; +} -- cgit