summaryrefslogtreecommitdiff
path: root/source4/lib/registry/tools
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-05-22 16:21:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:08:25 -0500
commit73da6bf6dad7e047fbadf22a04b2f62d22ede4bf (patch)
treefe052f0924eb580720742d9634a1ca872ac08c9f /source4/lib/registry/tools
parentc82c88dccbff92f111d4127e2f58ba79d5f82010 (diff)
downloadsamba-73da6bf6dad7e047fbadf22a04b2f62d22ede4bf.tar.gz
samba-73da6bf6dad7e047fbadf22a04b2f62d22ede4bf.tar.bz2
samba-73da6bf6dad7e047fbadf22a04b2f62d22ede4bf.zip
r15806: Remove some unnecessary nesting making the function harder to read.
(This used to be commit 2e1ce0189961335f654202074101819d8d933748)
Diffstat (limited to 'source4/lib/registry/tools')
-rw-r--r--source4/lib/registry/tools/regshell.c26
1 files changed, 15 insertions, 11 deletions
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;
}