From 097a056df9c1c3fc80a111f0ed2bb87ccbf86289 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Apr 2008 17:49:10 +0200 Subject: libsmbconf: testsuite: refactor printing of string lists out. Michael (This used to be commit 828c7297247a557ed8e2b6935bbc819aae95a660) --- source3/lib/smbconf/testsuite.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'source3/lib/smbconf/testsuite.c') diff --git a/source3/lib/smbconf/testsuite.c b/source3/lib/smbconf/testsuite.c index f159faac4d..e718e734e3 100644 --- a/source3/lib/smbconf/testsuite.c +++ b/source3/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; -- cgit