svn commit: samba r15806 - in branches/SAMBA_4_0/source/lib/registry/tools: .

jelmer at samba.org jelmer at samba.org
Mon May 22 16:21:53 GMT 2006


Author: jelmer
Date: 2006-05-22 16:21:52 +0000 (Mon, 22 May 2006)
New Revision: 15806

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15806

Log:
Remove some unnecessary nesting making the function harder to read.

Modified:
   branches/SAMBA_4_0/source/lib/registry/tools/regshell.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/registry/tools/regshell.c
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/tools/regshell.c	2006-05-22 16:16:48 UTC (rev 15805)
+++ branches/SAMBA_4_0/source/lib/registry/tools/regshell.c	2006-05-22 16:21:52 UTC (rev 15806)
@@ -90,20 +90,24 @@
 
 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;
 }
 



More information about the samba-cvs mailing list