From 73da6bf6dad7e047fbadf22a04b2f62d22ede4bf Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 22 May 2006 16:21:52 +0000 Subject: r15806: Remove some unnecessary nesting making the function harder to read. (This used to be commit 2e1ce0189961335f654202074101819d8d933748) --- source4/lib/registry/tools/regshell.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'source4/lib/registry') diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index a1a88378c9..5aa16d2e98 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -90,19 +90,23 @@ static struct registry_key *cmd_pwd(TALLOC_CTX *mem_ctx, struct registry_context static struct registry_key *cmd_set(TALLOC_CTX *mem_ctx, struct registry_context *ctx,struct registry_key *cur, int argc, char **argv) { + struct registry_value val; + WERROR error; + if (argc < 4) { fprintf(stderr, "Usage: set value-name type value\n"); - } else { - struct registry_value val; - if (reg_string_to_val(mem_ctx, argv[2], argv[3], &val.data_type, &val.data)) { - WERROR error = reg_val_set(cur, argv[1], val.data_type, val.data); - if (!W_ERROR_IS_OK(error)) { - fprintf(stderr, "Error setting value: %s\n", win_errstr(error)); - return NULL; - } - } else { - fprintf(stderr, "Unable to interpret data\n"); - } + return cur; + } + + if (!reg_string_to_val(mem_ctx, argv[2], argv[3], &val.data_type, &val.data)) { + fprintf(stderr, "Unable to interpret data\n"); + return cur; + } + + error = reg_val_set(cur, argv[1], val.data_type, val.data); + if (!W_ERROR_IS_OK(error)) { + fprintf(stderr, "Error setting value: %s\n", win_errstr(error)); + return NULL; } return cur; } -- cgit