aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-11-28 01:22:57 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2016-11-28 01:22:57 +0100
commit1d3a04a3a4be8682d4317251fc14e81ad655d58a (patch)
tree2ee72930778afa3a223327fec714c81d936f82dc
parent038a977d47c99c3e59d7a2393799b2afa838604c (diff)
downloadbusybox-w32-1d3a04a3a4be8682d4317251fc14e81ad655d58a.tar.gz
busybox-w32-1d3a04a3a4be8682d4317251fc14e81ad655d58a.tar.bz2
busybox-w32-1d3a04a3a4be8682d4317251fc14e81ad655d58a.zip
Code style fixes, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--e2fsprogs/fsck.c2
-rw-r--r--editors/patch.c11
-rw-r--r--editors/patch_toybox.c7
-rw-r--r--editors/sed.c5
-rw-r--r--loginutils/addgroup.c2
-rw-r--r--miscutils/makedevs.c2
-rw-r--r--miscutils/rx.c2
-rw-r--r--networking/interface.c8
-rw-r--r--networking/tc.c6
-rw-r--r--procps/pgrep.c2
-rw-r--r--runit/sv.c2
-rw-r--r--util-linux/getopt.c4
-rw-r--r--util-linux/readprofile.c7
13 files changed, 32 insertions, 28 deletions
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c
index 59514a1a6..6414988b4 100644
--- a/e2fsprogs/fsck.c
+++ b/e2fsprogs/fsck.c
@@ -658,7 +658,7 @@ static int device_already_active(char *device)
658 return (G.instance_list != NULL); 658 return (G.instance_list != NULL);
659 659
660 for (inst = G.instance_list; inst; inst = inst->next) { 660 for (inst = G.instance_list; inst; inst = inst->next) {
661 if (!inst->base_device || !strcmp(base, inst->base_device)) { 661 if (!inst->base_device || strcmp(base, inst->base_device) == 0) {
662 free(base); 662 free(base);
663 return 1; 663 return 1;
664 } 664 }
diff --git a/editors/patch.c b/editors/patch.c
index ea1fc0974..731a8c58a 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -247,7 +247,7 @@ static int apply_one_hunk(void)
247 // Figure out which line of hunk to compare with next. (Skip lines 247 // Figure out which line of hunk to compare with next. (Skip lines
248 // of the hunk we'd be adding.) 248 // of the hunk we'd be adding.)
249 while (plist && *plist->data == "+-"[reverse]) { 249 while (plist && *plist->data == "+-"[reverse]) {
250 if (data && !strcmp(data, plist->data+1)) { 250 if (data && strcmp(data, plist->data+1) == 0) {
251 if (!backwarn) { 251 if (!backwarn) {
252 backwarn = TT.linenum; 252 backwarn = TT.linenum;
253 if (option_mask32 & FLAG_IGNORE) { 253 if (option_mask32 & FLAG_IGNORE) {
@@ -291,8 +291,9 @@ static int apply_one_hunk(void)
291 291
292 for (;;) { 292 for (;;) {
293 while (plist && *plist->data == "+-"[reverse]) { 293 while (plist && *plist->data == "+-"[reverse]) {
294 if (!strcmp(check->data, plist->data+1) && 294 if (strcmp(check->data, plist->data+1) == 0
295 !backwarn) { 295 && !backwarn
296 ) {
296 backwarn = TT.linenum; 297 backwarn = TT.linenum;
297 if (option_mask32 & FLAG_IGNORE) { 298 if (option_mask32 & FLAG_IGNORE) {
298 dummy_revert = 1; 299 dummy_revert = 1;
@@ -491,7 +492,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
491 492
492 // We're deleting oldname if new file is /dev/null (before -p) 493 // We're deleting oldname if new file is /dev/null (before -p)
493 // or if new hunk is empty (zero context) after patching 494 // or if new hunk is empty (zero context) after patching
494 if (!strcmp(name, "/dev/null") || !(reverse ? oldsum : newsum)) { 495 if (strcmp(name, "/dev/null") == 0 || !(reverse ? oldsum : newsum)) {
495 name = reverse ? newname : oldname; 496 name = reverse ? newname : oldname;
496 empty = 1; 497 empty = 1;
497 } 498 }
@@ -527,7 +528,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
527 struct stat statbuf; 528 struct stat statbuf;
528 529
529 // If the old file was null, we're creating a new one. 530 // If the old file was null, we're creating a new one.
530 if (!strcmp(oldname, "/dev/null") || !oldsum) { 531 if (strcmp(oldname, "/dev/null") == 0 || !oldsum) {
531 printf("creating %s\n", name); 532 printf("creating %s\n", name);
532 s = strrchr(name, '/'); 533 s = strrchr(name, '/');
533 if (s) { 534 if (s) {
diff --git a/editors/patch_toybox.c b/editors/patch_toybox.c
index a60bf070f..5174acd6a 100644
--- a/editors/patch_toybox.c
+++ b/editors/patch_toybox.c
@@ -335,7 +335,7 @@ static int apply_one_hunk(void)
335 // Figure out which line of hunk to compare with next. (Skip lines 335 // Figure out which line of hunk to compare with next. (Skip lines
336 // of the hunk we'd be adding.) 336 // of the hunk we'd be adding.)
337 while (plist && *plist->data == "+-"[reverse]) { 337 while (plist && *plist->data == "+-"[reverse]) {
338 if (data && !strcmp(data, plist->data+1)) { 338 if (data && strcmp(data, plist->data+1) == 0) {
339 if (!backwarn) { 339 if (!backwarn) {
340 fdprintf(2,"Possibly reversed hunk %d at %ld\n", 340 fdprintf(2,"Possibly reversed hunk %d at %ld\n",
341 TT.hunknum, TT.linenum); 341 TT.hunknum, TT.linenum);
@@ -529,8 +529,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
529 529
530 // We're deleting oldname if new file is /dev/null (before -p) 530 // We're deleting oldname if new file is /dev/null (before -p)
531 // or if new hunk is empty (zero context) after patching 531 // or if new hunk is empty (zero context) after patching
532 if (!strcmp(name, "/dev/null") || !(reverse ? oldsum : newsum)) 532 if (strcmp(name, "/dev/null") == 0 || !(reverse ? oldsum : newsum)) {
533 {
534 name = reverse ? newname : oldname; 533 name = reverse ? newname : oldname;
535 del++; 534 del++;
536 } 535 }
@@ -551,7 +550,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
551 // If we've got a file to open, do so. 550 // If we've got a file to open, do so.
552 } else if (!(option_mask32 & FLAG_PATHLEN) || i <= TT.prefix) { 551 } else if (!(option_mask32 & FLAG_PATHLEN) || i <= TT.prefix) {
553 // If the old file was null, we're creating a new one. 552 // If the old file was null, we're creating a new one.
554 if (!strcmp(oldname, "/dev/null") || !oldsum) { 553 if (strcmp(oldname, "/dev/null") == 0 || !oldsum) {
555 printf("creating %s\n", name); 554 printf("creating %s\n", name);
556 s = strrchr(name, '/'); 555 s = strrchr(name, '/');
557 if (s) { 556 if (s) {
diff --git a/editors/sed.c b/editors/sed.c
index b7add1fb1..637a6851b 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -892,7 +892,10 @@ static sed_cmd_t *branch_to(char *label)
892 sed_cmd_t *sed_cmd; 892 sed_cmd_t *sed_cmd;
893 893
894 for (sed_cmd = G.sed_cmd_head; sed_cmd; sed_cmd = sed_cmd->next) { 894 for (sed_cmd = G.sed_cmd_head; sed_cmd; sed_cmd = sed_cmd->next) {
895 if (sed_cmd->cmd == ':' && sed_cmd->string && !strcmp(sed_cmd->string, label)) { 895 if (sed_cmd->cmd == ':'
896 && sed_cmd->string
897 && strcmp(sed_cmd->string, label) == 0
898 ) {
896 return sed_cmd; 899 return sed_cmd;
897 } 900 }
898 } 901 }
diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c
index 4d4fc3f28..6b2fd7ba9 100644
--- a/loginutils/addgroup.c
+++ b/loginutils/addgroup.c
@@ -186,7 +186,7 @@ int addgroup_main(int argc UNUSED_PARAM, char **argv)
186 gr = xgetgrnam(argv[1]); /* unknown group: exit */ 186 gr = xgetgrnam(argv[1]); /* unknown group: exit */
187 /* check if user is already in this group */ 187 /* check if user is already in this group */
188 for (; *(gr->gr_mem) != NULL; (gr->gr_mem)++) { 188 for (; *(gr->gr_mem) != NULL; (gr->gr_mem)++) {
189 if (!strcmp(argv[0], *(gr->gr_mem))) { 189 if (strcmp(argv[0], *(gr->gr_mem)) == 0) {
190 /* user is already in group: do nothing */ 190 /* user is already in group: do nothing */
191 return EXIT_SUCCESS; 191 return EXIT_SUCCESS;
192 } 192 }
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index c5eeed0e0..9e7ca340f 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -283,7 +283,7 @@ int makedevs_main(int argc UNUSED_PARAM, char **argv)
283 sprintf(full_name_inc, count ? "%s%u" : "%s", full_name, i); 283 sprintf(full_name_inc, count ? "%s%u" : "%s", full_name, i);
284 rdev = makedev(major, minor + (i - start) * increment); 284 rdev = makedev(major, minor + (i - start) * increment);
285 if (mknod(full_name_inc, mode, rdev) != 0 285 if (mknod(full_name_inc, mode, rdev) != 0
286 && errno != EEXIST 286 && errno != EEXIST
287 ) { 287 ) {
288 bb_perror_msg("line %d: can't create node %s", linenum, full_name_inc); 288 bb_perror_msg("line %d: can't create node %s", linenum, full_name_inc);
289 ret = EXIT_FAILURE; 289 ret = EXIT_FAILURE;
diff --git a/miscutils/rx.c b/miscutils/rx.c
index 7fca8e36b..660f66a89 100644
--- a/miscutils/rx.c
+++ b/miscutils/rx.c
@@ -111,7 +111,7 @@ static int receive(/*int read_fd, */int file_fd)
111 && blockBuf[blockLength - 3] == PAD 111 && blockBuf[blockLength - 3] == PAD
112 ) { 112 ) {
113 while (blockLength 113 while (blockLength
114 && blockBuf[blockLength - 1] == PAD 114 && blockBuf[blockLength - 1] == PAD
115 ) { 115 ) {
116 blockLength--; 116 blockLength--;
117 } 117 }
diff --git a/networking/interface.c b/networking/interface.c
index e5723b428..c5c8f2cdd 100644
--- a/networking/interface.c
+++ b/networking/interface.c
@@ -264,7 +264,7 @@ const struct aftype* FAST_FUNC get_aftype(const char *name)
264 264
265 afp = aftypes; 265 afp = aftypes;
266 while (*afp != NULL) { 266 while (*afp != NULL) {
267 if (!strcmp((*afp)->name, name)) 267 if (strcmp((*afp)->name, name) == 0)
268 return (*afp); 268 return (*afp);
269 afp++; 269 afp++;
270 } 270 }
@@ -572,7 +572,7 @@ static int if_readlist_proc(char *target)
572 ife = add_interface(name); 572 ife = add_interface(name);
573 get_dev_fields(s, ife, procnetdev_vsn); 573 get_dev_fields(s, ife, procnetdev_vsn);
574 ife->statistics_valid = 1; 574 ife->statistics_valid = 1;
575 if (target && !strcmp(target, name)) 575 if (target && strcmp(target, name) == 0)
576 break; 576 break;
577 } 577 }
578 if (ferror(fh)) { 578 if (ferror(fh)) {
@@ -781,7 +781,7 @@ const struct hwtype* FAST_FUNC get_hwtype(const char *name)
781 781
782 hwp = hwtypes; 782 hwp = hwtypes;
783 while (*hwp != NULL) { 783 while (*hwp != NULL) {
784 if (!strcmp((*hwp)->name, name)) 784 if (strcmp((*hwp)->name, name) == 0)
785 return (*hwp); 785 return (*hwp);
786 hwp++; 786 hwp++;
787 } 787 }
@@ -877,7 +877,7 @@ static void ife_print6(struct interface *ptr)
877 addr6p[5], addr6p[6], addr6p[7], &if_idx, &plen, &scope, 877 addr6p[5], addr6p[6], addr6p[7], &if_idx, &plen, &scope,
878 &dad_status, devname) != EOF 878 &dad_status, devname) != EOF
879 ) { 879 ) {
880 if (!strcmp(devname, ptr->name)) { 880 if (strcmp(devname, ptr->name) == 0) {
881 sprintf(addr6, "%s:%s:%s:%s:%s:%s:%s:%s", 881 sprintf(addr6, "%s:%s:%s:%s:%s:%s:%s:%s",
882 addr6p[0], addr6p[1], addr6p[2], addr6p[3], 882 addr6p[0], addr6p[1], addr6p[2], addr6p[3],
883 addr6p[4], addr6p[5], addr6p[6], addr6p[7]); 883 addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
diff --git a/networking/tc.c b/networking/tc.c
index 271d569e4..25875aa3e 100644
--- a/networking/tc.c
+++ b/networking/tc.c
@@ -116,7 +116,7 @@ static int get_qdisc_handle(uint32_t *h, const char *str) {
116 char *p; 116 char *p;
117 117
118 maj = TC_H_UNSPEC; 118 maj = TC_H_UNSPEC;
119 if (!strcmp(str, "none")) 119 if (strcmp(str, "none") == 0)
120 goto ok; 120 goto ok;
121 maj = strtoul(str, &p, 16); 121 maj = strtoul(str, &p, 16);
122 if (p == str) 122 if (p == str)
@@ -135,10 +135,10 @@ static int get_tc_classid(uint32_t *h, const char *str) {
135 char *p; 135 char *p;
136 136
137 maj = TC_H_ROOT; 137 maj = TC_H_ROOT;
138 if (!strcmp(str, "root")) 138 if (strcmp(str, "root") == 0)
139 goto ok; 139 goto ok;
140 maj = TC_H_UNSPEC; 140 maj = TC_H_UNSPEC;
141 if (!strcmp(str, "none")) 141 if (strcmp(str, "none") == 0)
142 goto ok; 142 goto ok;
143 maj = strtoul(str, &p, 16); 143 maj = strtoul(str, &p, 16);
144 if (p == str) { 144 if (p == str) {
diff --git a/procps/pgrep.c b/procps/pgrep.c
index 974d007f3..ac82b5156 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -168,7 +168,7 @@ int pgrep_main(int argc UNUSED_PARAM, char **argv)
168 168
169 if (ppid2match >= 0 && ppid2match != proc->ppid) 169 if (ppid2match >= 0 && ppid2match != proc->ppid)
170 continue; 170 continue;
171 if (sid2match >= 0 && sid2match != proc->sid) 171 if (sid2match >= 0 && sid2match != proc->sid)
172 continue; 172 continue;
173 173
174 /* NB: OPT_INVERT is always 0 or 1 */ 174 /* NB: OPT_INVERT is always 0 or 1 */
diff --git a/runit/sv.c b/runit/sv.c
index 37df9a929..42abbbbb5 100644
--- a/runit/sv.c
+++ b/runit/sv.c
@@ -210,7 +210,7 @@ struct globals {
210#define INIT_G() do { setup_common_bufsiz(); } while (0) 210#define INIT_G() do { setup_common_bufsiz(); } while (0)
211 211
212 212
213#define str_equal(s,t) (!strcmp((s), (t))) 213#define str_equal(s,t) (strcmp((s), (t)) == 0)
214 214
215 215
216static void fatal_cannot(const char *m1) NORETURN; 216static void fatal_cannot(const char *m1) NORETURN;
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index 83cc1efea..f6ecc3dde 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
347 347
348static void set_shell(const char *new_shell) 348static void set_shell(const char *new_shell)
349{ 349{
350 if (!strcmp(new_shell, "bash") || !strcmp(new_shell, "sh")) 350 if (strcmp(new_shell, "bash") == 0 || strcmp(new_shell, "sh") == 0)
351 return; 351 return;
352 if (!strcmp(new_shell, "tcsh") || !strcmp(new_shell, "csh")) 352 if (strcmp(new_shell, "tcsh") == 0 || strcmp(new_shell, "csh") == 0)
353 option_mask32 |= SHELL_IS_TCSH; 353 option_mask32 |= SHELL_IS_TCSH;
354 else 354 else
355 bb_error_msg("unknown shell '%s', assuming bash", new_shell); 355 bb_error_msg("unknown shell '%s', assuming bash", new_shell);
diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c
index d5230387c..31abb6bb2 100644
--- a/util-linux/readprofile.c
+++ b/util-linux/readprofile.c
@@ -174,7 +174,7 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
174 bb_error_msg_and_die("%s(%i): wrong map line", 174 bb_error_msg_and_die("%s(%i): wrong map line",
175 mapFile, maplineno); 175 mapFile, maplineno);
176 176
177 if (!strcmp(fn_name, "_stext")) /* only elf works like this */ { 177 if (strcmp(fn_name, "_stext") == 0) /* only elf works like this */ {
178 add0 = fn_add; 178 add0 = fn_add;
179 break; 179 break;
180 } 180 }
@@ -224,8 +224,9 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
224 if (optBins) { 224 if (optBins) {
225 if (optVerbose || this > 0) 225 if (optVerbose || this > 0)
226 printf(" total\t\t\t\t%u\n", this); 226 printf(" total\t\t\t\t%u\n", this);
227 } else if ((this || optAll) 227 } else
228 && (fn_len = next_add-fn_add) != 0 228 if ((this || optAll)
229 && (fn_len = next_add-fn_add) != 0
229 ) { 230 ) {
230 if (optVerbose) 231 if (optVerbose)
231 printf("%016llx %-40s %6u %8.4f\n", fn_add, 232 printf("%016llx %-40s %6u %8.4f\n", fn_add,