Code style fixes, no code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2016-11-28 01:22:57 +01:00
parent 038a977d47
commit 1d3a04a3a4
13 changed files with 32 additions and 28 deletions

View 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;
}

View 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) {

View 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) {

View 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;
}
}

View 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;
}

View 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]);

View 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) {

View 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;

View 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);

View 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,7 +224,8 @@ 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)
} else
if ((this || optAll)
&& (fn_len = next_add-fn_add) != 0
) {
if (optVerbose)