From: Michael Adam Date: Tue, 8 Apr 2008 15:49:10 +0000 (+0200) Subject: libsmbconf: testsuite: refactor printing of string lists out. X-Git-Tag: samba-3.3.0pre1~2793 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=828c7297247a557ed8e2b6935bbc819aae95a660;p=thirdparty%2Fsamba.git libsmbconf: testsuite: refactor printing of string lists out. Michael --- diff --git a/source/lib/smbconf/testsuite.c b/source/lib/smbconf/testsuite.c index f159faac4dd..e718e734e39 100644 --- a/source/lib/smbconf/testsuite.c +++ b/source/lib/smbconf/testsuite.c @@ -19,11 +19,24 @@ #include "includes.h" +static void print_strings(const char *prefix, + uint32_t num_strings, const char **strings) +{ + uint32_t count; + + if (prefix == NULL) { + prefix = ""; + } + + for (count = 0; count < num_strings; count++) { + printf("%s%s\n", prefix, strings[count]); + } +} + static bool test_get_includes(struct smbconf_ctx *ctx) { WERROR werr; bool ret = false; - uint32_t count; uint32_t num_includes = 0; char **includes = NULL; TALLOC_CTX *mem_ctx = talloc_stackframe(); @@ -38,9 +51,7 @@ static bool test_get_includes(struct smbconf_ctx *ctx) printf("got %u includes%s\n", num_includes, (num_includes > 0) ? ":" : "."); - for (count = 0; count < num_includes; count++) { - printf("%s\n", includes[count]); - } + print_strings("", num_includes, (const char **)includes); printf("success: get_includes\n"); ret = true;