[git commit] Code style fixes, no code changes

Denys Vlasenko vda.linux at googlemail.com
Mon Nov 28 00:22:57 UTC 2016


commit: https://git.busybox.net/busybox/commit/?id=1d3a04a3a4be8682d4317251fc14e81ad655d58a
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 e2fsprogs/fsck.c         |  2 +-
 editors/patch.c          | 11 ++++++-----
 editors/patch_toybox.c   |  7 +++----
 editors/sed.c            |  5 ++++-
 loginutils/addgroup.c    |  2 +-
 miscutils/makedevs.c     |  2 +-
 miscutils/rx.c           |  2 +-
 networking/interface.c   |  8 ++++----
 networking/tc.c          |  6 +++---
 procps/pgrep.c           |  2 +-
 runit/sv.c               |  2 +-
 util-linux/getopt.c      |  4 ++--
 util-linux/readprofile.c |  7 ++++---
 13 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c
index 59514a1..6414988 100644
--- a/e2fsprogs/fsck.c
+++ b/e2fsprogs/fsck.c
@@ -658,7 +658,7 @@ static int device_already_active(char *device)
 		return (G.instance_list != NULL);
 
 	for (inst = G.instance_list; inst; inst = inst->next) {
-		if (!inst->base_device || !strcmp(base, inst->base_device)) {
+		if (!inst->base_device || strcmp(base, inst->base_device) == 0) {
 			free(base);
 			return 1;
 		}
diff --git a/editors/patch.c b/editors/patch.c
index ea1fc09..731a8c5 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -247,7 +247,7 @@ static int apply_one_hunk(void)
 		// Figure out which line of hunk to compare with next.  (Skip lines
 		// of the hunk we'd be adding.)
 		while (plist && *plist->data == "+-"[reverse]) {
-			if (data && !strcmp(data, plist->data+1)) {
+			if (data && strcmp(data, plist->data+1) == 0) {
 				if (!backwarn) {
 					backwarn = TT.linenum;
 					if (option_mask32 & FLAG_IGNORE) {
@@ -291,8 +291,9 @@ static int apply_one_hunk(void)
 
 		for (;;) {
 			while (plist && *plist->data == "+-"[reverse]) {
-				if (!strcmp(check->data, plist->data+1) &&
-				    !backwarn) {
+				if (strcmp(check->data, plist->data+1) == 0
+				 && !backwarn
+				) {
 					backwarn = TT.linenum;
 					if (option_mask32 & FLAG_IGNORE) {
 						dummy_revert = 1;
@@ -491,7 +492,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
 
 				// We're deleting oldname if new file is /dev/null (before -p)
 				// or if new hunk is empty (zero context) after patching
-				if (!strcmp(name, "/dev/null") || !(reverse ? oldsum : newsum)) {
+				if (strcmp(name, "/dev/null") == 0 || !(reverse ? oldsum : newsum)) {
 					name = reverse ? newname : oldname;
 					empty = 1;
 				}
@@ -527,7 +528,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
 					struct stat statbuf;
 
 					// If the old file was null, we're creating a new one.
-					if (!strcmp(oldname, "/dev/null") || !oldsum) {
+					if (strcmp(oldname, "/dev/null") == 0 || !oldsum) {
 						printf("creating %s\n", name);
 						s = strrchr(name, '/');
 						if (s) {
diff --git a/editors/patch_toybox.c b/editors/patch_toybox.c
index a60bf07..5174acd 100644
--- a/editors/patch_toybox.c
+++ b/editors/patch_toybox.c
@@ -335,7 +335,7 @@ static int apply_one_hunk(void)
 		// Figure out which line of hunk to compare with next.  (Skip lines
 		// of the hunk we'd be adding.)
 		while (plist && *plist->data == "+-"[reverse]) {
-			if (data && !strcmp(data, plist->data+1)) {
+			if (data && strcmp(data, plist->data+1) == 0) {
 				if (!backwarn) {
 					fdprintf(2,"Possibly reversed hunk %d at %ld\n",
 						TT.hunknum, TT.linenum);
@@ -529,8 +529,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
 
 				// We're deleting oldname if new file is /dev/null (before -p)
 				// or if new hunk is empty (zero context) after patching
-				if (!strcmp(name, "/dev/null") || !(reverse ? oldsum : newsum))
-				{
+				if (strcmp(name, "/dev/null") == 0 || !(reverse ? oldsum : newsum)) {
 					name = reverse ? newname : oldname;
 					del++;
 				}
@@ -551,7 +550,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
 				// If we've got a file to open, do so.
 				} else if (!(option_mask32 & FLAG_PATHLEN) || i <= TT.prefix) {
 					// If the old file was null, we're creating a new one.
-					if (!strcmp(oldname, "/dev/null") || !oldsum) {
+					if (strcmp(oldname, "/dev/null") == 0 || !oldsum) {
 						printf("creating %s\n", name);
 						s = strrchr(name, '/');
 						if (s) {
diff --git a/editors/sed.c b/editors/sed.c
index b7add1f..637a685 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -892,7 +892,10 @@ static sed_cmd_t *branch_to(char *label)
 	sed_cmd_t *sed_cmd;
 
 	for (sed_cmd = G.sed_cmd_head; sed_cmd; sed_cmd = sed_cmd->next) {
-		if (sed_cmd->cmd == ':' && sed_cmd->string && !strcmp(sed_cmd->string, label)) {
+		if (sed_cmd->cmd == ':'
+		 && sed_cmd->string
+		 && strcmp(sed_cmd->string, label) == 0
+		) {
 			return sed_cmd;
 		}
 	}
diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c
index 4d4fc3f..6b2fd7b 100644
--- a/loginutils/addgroup.c
+++ b/loginutils/addgroup.c
@@ -186,7 +186,7 @@ int addgroup_main(int argc UNUSED_PARAM, char **argv)
 		gr = xgetgrnam(argv[1]); /* unknown group: exit */
 		/* check if user is already in this group */
 		for (; *(gr->gr_mem) != NULL; (gr->gr_mem)++) {
-			if (!strcmp(argv[0], *(gr->gr_mem))) {
+			if (strcmp(argv[0], *(gr->gr_mem)) == 0) {
 				/* user is already in group: do nothing */
 				return EXIT_SUCCESS;
 			}
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index c5eeed0..9e7ca34 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -283,7 +283,7 @@ int makedevs_main(int argc UNUSED_PARAM, char **argv)
 				sprintf(full_name_inc, count ? "%s%u" : "%s", full_name, i);
 				rdev = makedev(major, minor + (i - start) * increment);
 				if (mknod(full_name_inc, mode, rdev) != 0
-				  && errno != EEXIST
+				 && errno != EEXIST
 				) {
 					bb_perror_msg("line %d: can't create node %s", linenum, full_name_inc);
 					ret = EXIT_FAILURE;
diff --git a/miscutils/rx.c b/miscutils/rx.c
index 7fca8e3..660f66a 100644
--- a/miscutils/rx.c
+++ b/miscutils/rx.c
@@ -111,7 +111,7 @@ static int receive(/*int read_fd, */int file_fd)
 			 && blockBuf[blockLength - 3] == PAD
 			) {
 				while (blockLength
-			           && blockBuf[blockLength - 1] == PAD
+				    && blockBuf[blockLength - 1] == PAD
 				) {
 					blockLength--;
 				}
diff --git a/networking/interface.c b/networking/interface.c
index e5723b4..c5c8f2c 100644
--- a/networking/interface.c
+++ b/networking/interface.c
@@ -264,7 +264,7 @@ const struct aftype* FAST_FUNC get_aftype(const char *name)
 
 	afp = aftypes;
 	while (*afp != NULL) {
-		if (!strcmp((*afp)->name, name))
+		if (strcmp((*afp)->name, name) == 0)
 			return (*afp);
 		afp++;
 	}
@@ -572,7 +572,7 @@ static int if_readlist_proc(char *target)
 		ife = add_interface(name);
 		get_dev_fields(s, ife, procnetdev_vsn);
 		ife->statistics_valid = 1;
-		if (target && !strcmp(target, name))
+		if (target && strcmp(target, name) == 0)
 			break;
 	}
 	if (ferror(fh)) {
@@ -781,7 +781,7 @@ const struct hwtype* FAST_FUNC get_hwtype(const char *name)
 
 	hwp = hwtypes;
 	while (*hwp != NULL) {
-		if (!strcmp((*hwp)->name, name))
+		if (strcmp((*hwp)->name, name) == 0)
 			return (*hwp);
 		hwp++;
 	}
@@ -877,7 +877,7 @@ static void ife_print6(struct interface *ptr)
 			addr6p[5], addr6p[6], addr6p[7], &if_idx, &plen, &scope,
 			&dad_status, devname) != EOF
 	) {
-		if (!strcmp(devname, ptr->name)) {
+		if (strcmp(devname, ptr->name) == 0) {
 			sprintf(addr6, "%s:%s:%s:%s:%s:%s:%s:%s",
 					addr6p[0], addr6p[1], addr6p[2], addr6p[3],
 					addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
diff --git a/networking/tc.c b/networking/tc.c
index 271d569..25875aa 100644
--- a/networking/tc.c
+++ b/networking/tc.c
@@ -116,7 +116,7 @@ static int get_qdisc_handle(uint32_t *h, const char *str) {
 	char *p;
 
 	maj = TC_H_UNSPEC;
-	if (!strcmp(str, "none"))
+	if (strcmp(str, "none") == 0)
 		goto ok;
 	maj = strtoul(str, &p, 16);
 	if (p == str)
@@ -135,10 +135,10 @@ static int get_tc_classid(uint32_t *h, const char *str) {
 	char *p;
 
 	maj = TC_H_ROOT;
-	if (!strcmp(str, "root"))
+	if (strcmp(str, "root") == 0)
 		goto ok;
 	maj = TC_H_UNSPEC;
-	if (!strcmp(str, "none"))
+	if (strcmp(str, "none") == 0)
 		goto ok;
 	maj = strtoul(str, &p, 16);
 	if (p == str) {
diff --git a/procps/pgrep.c b/procps/pgrep.c
index 974d007..ac82b51 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -168,7 +168,7 @@ int pgrep_main(int argc UNUSED_PARAM, char **argv)
 
 		if (ppid2match >= 0 && ppid2match != proc->ppid)
 			continue;
-		if (sid2match >= 0  && sid2match != proc->sid)
+		if (sid2match >= 0 && sid2match != proc->sid)
 			continue;
 
 		/* NB: OPT_INVERT is always 0 or 1 */
diff --git a/runit/sv.c b/runit/sv.c
index 37df9a9..42abbbb 100644
--- a/runit/sv.c
+++ b/runit/sv.c
@@ -210,7 +210,7 @@ struct globals {
 #define INIT_G() do { setup_common_bufsiz(); } while (0)
 
 
-#define str_equal(s,t) (!strcmp((s), (t)))
+#define str_equal(s,t) (strcmp((s), (t)) == 0)
 
 
 static void fatal_cannot(const char *m1) NORETURN;
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index 83cc1ef..f6ecc3d 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -347,9 +347,9 @@ static struct option *add_long_options(struct option *long_options, char *option
 
 static void set_shell(const char *new_shell)
 {
-	if (!strcmp(new_shell, "bash") || !strcmp(new_shell, "sh"))
+	if (strcmp(new_shell, "bash") == 0 || strcmp(new_shell, "sh") == 0)
 		return;
-	if (!strcmp(new_shell, "tcsh") || !strcmp(new_shell, "csh"))
+	if (strcmp(new_shell, "tcsh") == 0 || strcmp(new_shell, "csh") == 0)
 		option_mask32 |= SHELL_IS_TCSH;
 	else
 		bb_error_msg("unknown shell '%s', assuming bash", new_shell);
diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c
index d523038..31abb6b 100644
--- a/util-linux/readprofile.c
+++ b/util-linux/readprofile.c
@@ -174,7 +174,7 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
 			bb_error_msg_and_die("%s(%i): wrong map line",
 					mapFile, maplineno);
 
-		if (!strcmp(fn_name, "_stext")) /* only elf works like this */ {
+		if (strcmp(fn_name, "_stext") == 0) /* only elf works like this */ {
 			add0 = fn_add;
 			break;
 		}
@@ -224,8 +224,9 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
 		if (optBins) {
 			if (optVerbose || this > 0)
 				printf("  total\t\t\t\t%u\n", this);
-		} else if ((this || optAll)
-		        && (fn_len = next_add-fn_add) != 0
+		} else
+		if ((this || optAll)
+		 && (fn_len = next_add-fn_add) != 0
 		) {
 			if (optVerbose)
 				printf("%016llx %-40s %6u %8.4f\n", fn_add,


More information about the busybox-cvs mailing list