From dfa8d9356cea0dd6a1b013a72c3d68c026deb511 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 00:05:23 +0100 Subject: Move format_value() to libnet_conf.c. Michael (This used to be commit 3422a5048ad4b7f789ec233356885d78dbdacf9a) --- source3/libnet/libnet_conf.c | 34 ++++++++++++++++++++++++++++++++++ source3/utils/net_conf.c | 33 --------------------------------- 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 93e13009a4..5389d856b3 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -222,6 +222,40 @@ done: return werr; } +char *format_value(TALLOC_CTX *mem_ctx, struct registry_value *value) +{ + char *result = NULL; + + /* what if mem_ctx = NULL? */ + + switch (value->type) { + case REG_DWORD: + result = talloc_asprintf(mem_ctx, "%d", value->v.dword); + break; + case REG_SZ: + case REG_EXPAND_SZ: + result = talloc_asprintf(mem_ctx, "%s", value->v.sz.str); + break; + case REG_MULTI_SZ: { + uint32 j; + for (j = 0; j < value->v.multi_sz.num_strings; j++) { + result = talloc_asprintf(mem_ctx, "\"%s\" ", + value->v.multi_sz.strings[j]); + } + break; + } + case REG_BINARY: + result = talloc_asprintf(mem_ctx, "binary (%d bytes)", + (int)value->v.binary.length); + break; + default: + result = talloc_asprintf(mem_ctx, ""); + break; + } + return result; +} + + /********************************************************************** * * The actual net conf api functions, that are exported. diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 8b89f2fa6f..98cc1ee198 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -110,39 +110,6 @@ static int net_conf_delparm_usage(int argc, const char **argv) * Helper functions */ -static char *format_value(TALLOC_CTX *mem_ctx, struct registry_value *value) -{ - char *result = NULL; - - /* what if mem_ctx = NULL? */ - - switch (value->type) { - case REG_DWORD: - result = talloc_asprintf(mem_ctx, "%d", value->v.dword); - break; - case REG_SZ: - case REG_EXPAND_SZ: - result = talloc_asprintf(mem_ctx, "%s", value->v.sz.str); - break; - case REG_MULTI_SZ: { - uint32 j; - for (j = 0; j < value->v.multi_sz.num_strings; j++) { - result = talloc_asprintf(mem_ctx, "\"%s\" ", - value->v.multi_sz.strings[j]); - } - break; - } - case REG_BINARY: - result = talloc_asprintf(mem_ctx, "binary (%d bytes)", - (int)value->v.binary.length); - break; - default: - result = talloc_asprintf(mem_ctx, ""); - break; - } - return result; -} - static WERROR list_values(TALLOC_CTX *ctx, struct registry_key *key) { WERROR werr = WERR_OK; -- cgit