Code style fixes, no code changes
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 28 Nov 2016 00:22:57 +0000 (01:22 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 28 Nov 2016 00:22:57 +0000 (01:22 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
13 files changed:
e2fsprogs/fsck.c
editors/patch.c
editors/patch_toybox.c
editors/sed.c
loginutils/addgroup.c
miscutils/makedevs.c
miscutils/rx.c
networking/interface.c
networking/tc.c
procps/pgrep.c
runit/sv.c
util-linux/getopt.c
util-linux/readprofile.c

index 59514a1a6c629c6bd63d71c8c6befd92a76da76d..6414988b49e2a2ea5ff446de77efd838cfc127dc 100644 (file)
@@ -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;
                }
index ea1fc097497dbab39a19b78b3797f706bf00ce98..731a8c58acf6779da52a8b2a3b2e9a10acfcf80c 100644 (file)
@@ -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) {
index a60bf070fc4a74db08c76245c0ffb9ebf09a64ec..5174acd6a9315f23e886d607eb5d6f3df916c884 100644 (file)
@@ -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) {
index b7add1fb1722c4199ec0f1a1eb4e2c01d2c8e7c8..637a6851bcbd726c44c2b2786a162930b87caf77 100644 (file)
@@ -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;
                }
        }
index 4d4fc3f28c3aa20a9a9456a090b18e8f3bfee1a1..6b2fd7ba9b0a91ce7120cbaaff0be3e708d888e1 100644 (file)
@@ -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;
                        }
index c5eeed0e0c4872667feeca2013ead2e7f98d9440..9e7ca340f5eac0acf38c286e2d60042c95800d24 100644 (file)
@@ -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;
index 7fca8e36b911555ee041a27a8e68a5aaeab9a722..660f66a89d70df4ac46ce4177ee3f7c4f950614f 100644 (file)
@@ -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--;
                                }
index e5723b42830511c466fc193c912a1076846abae6..c5c8f2cddb8fde0f95e0aa85c952815fbe583bdb 100644 (file)
@@ -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]);
index 271d569e40a1a14e57be2bd3261ff925700a77e8..25875aa3e3036c9a9a1e5f7a60375316f29d12dc 100644 (file)
@@ -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) {
index 974d007f33036c40d8d932019614a776f6e75a16..ac82b5156a9133d94a100e70cb2b79049ca93d61 100644 (file)
@@ -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 */
index 37df9a9290139a579acfeab7617895bf70498ae0..42abbbbb5d1c36e54f5d0d400f5a6c83abab9d32 100644 (file)
@@ -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;
index 83cc1efea88873a6d8a624e2af32309ac5fa602b..f6ecc3dded97270ddbefb6498bf168fe0a835b09 100644 (file)
@@ -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);
index d5230387cc8d034ba5db41ac1dd25901c5de4b38..31abb6bb25976028cc8b703db4bc6850840b57e2 100644 (file)
@@ -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,