Code style fixes, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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 @@
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 @@
// 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 @@
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 @@
// 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 @@
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 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
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 @@
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 @@
&& 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 @@
afp = aftypes;
while (*afp != NULL) {
- if (!strcmp((*afp)->name, name))
+ if (strcmp((*afp)->name, name) == 0)
return (*afp);
afp++;
}
@@ -572,7 +572,7 @@
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 @@
hwp = hwtypes;
while (*hwp != NULL) {
- if (!strcmp((*hwp)->name, name))
+ if (strcmp((*hwp)->name, name) == 0)
return (*hwp);
hwp++;
}
@@ -877,7 +877,7 @@
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 @@
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 @@
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 @@
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 @@
#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 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 @@
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 @@
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,