diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2017-08-02 23:25:13 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2017-08-03 04:21:23 +0200 |
commit | 6afad7276402a90b3776ddeefb205978af42fdab (patch) | |
tree | 595886e869c364e504eacc1d472c07ae51d7bb4a /ax25/access.c | |
parent | ca4de17280673efe76a95bf904d11e1fa75c62d4 (diff) |
Delete more assignments in if conditions.
Based on below coccinelle script with a bad transformation fixed up
manually.
@if1@
expression E, F, G;
binary operator X;
statement S;
@@
- if ((E = F) X G)
+ E = F;
+ if (E X G)
S
@if2@
expression E, F, G;
binary operator X;
statement S;
@@
- if (G X (E = F))
+ E = F;
+ if (E X G)
S
@if3@
expression E, F;
statement S;
@@
- if (!(E = F))
+ E = F;
+ if (!E)
S
@if4@
expression E, F;
statement S;
@@
- if ((E = F))
+ E = F;
+ if (E)
S
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'ax25/access.c')
-rw-r--r-- | ax25/access.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/ax25/access.c b/ax25/access.c index 2ecbb1d..05d3375 100644 --- a/ax25/access.c +++ b/ax25/access.c @@ -210,7 +210,8 @@ static void write_example_passwd(char *pwfile, char pwlocation, return; fchown(i, (pwlocation == SYSTEMPW ? 0 : pw->pw_uid), (pwlocation == SYSTEMPW ? 0 : pw->pw_gid)); close(i); - if ( ! (f = fopen(pwfile, "w")) ) + f = fopen(pwfile, "w"); + if (!f) return; fprintf(f, "# %s Password file for axspawn\n", (pwlocation == SYSTEMPW ? "System" : "User")); if (pwlocation == SYSTEMPW) { @@ -255,7 +256,8 @@ char *read_pwd (struct passwd *pw, int *pwtype) } if (!S_ISREG(statbuf.st_mode) || (statbuf.st_mode & (S_IROTH | S_IWOTH))) continue; - if ( !(f = fopen(pwfile, "r")) ) + f = fopen(pwfile, "r"); + if (!f) continue; } else { if (only_systempw) @@ -300,7 +302,8 @@ char *read_pwd (struct passwd *pw, int *pwtype) write_ax25(buf, strlen(buf), 1); /* go on.. if user takes no action, he always gets this message */ } - if ( !(f = fopen(pwfile, "r")) ) + f = fopen(pwfile, "r"); + if (!f) goto end; } @@ -321,7 +324,8 @@ char *read_pwd (struct passwd *pw, int *pwtype) } goto end; } - if ((p = strchr(buf, '\n'))) + p = strchr(buf, '\n'); + if (p) *p = 0; if (!*buf || isspace(*buf & 0xff)) continue; @@ -332,7 +336,8 @@ char *read_pwd (struct passwd *pw, int *pwtype) only_systempw = 1; continue; } - if (!(p = strchr(buf, ':'))) + p = strchr(buf, ':'); + if (!p) continue; *p++ = 0; if (strcmp(pw->pw_name, buf)) @@ -345,7 +350,8 @@ char *read_pwd (struct passwd *pw, int *pwtype) if (!Strcasecmp(p_buf, "unix")) { pass = p_buf; } else { - if (!(pass = strchr(p_buf, ':'))) + pass = strchr(p_buf, ':'); + if (!pass) continue; *pass++ = 0; } |