diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2017-07-28 14:10:07 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2017-07-31 04:29:44 +0200 |
commit | daba307035faf4cc01f1ccb883b21281d91234cc (patch) | |
tree | edbd5df9285303f281524fac8064866057ce35ce /ax25/axspawn.c | |
parent | 71b0582584ac5de97141ea207ddf17f7c938b2df (diff) |
treewide: Kill assignments in if conditions.
Somewhat hard to read and the code base already has many overlong
lines.
Found with below spatch file and some manual editing in ax25/access.c
to restore a comment lost by spatch.
@parens@
expression E, F, G;
binary operator X;
statement S;
@@
- if ((E = F) X G)
+ E = F;
+ if (E X G)
S
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'ax25/axspawn.c')
-rw-r--r-- | ax25/axspawn.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ax25/axspawn.c b/ax25/axspawn.c index c9736b6..60fc836 100644 --- a/ax25/axspawn.c +++ b/ax25/axspawn.c @@ -648,7 +648,8 @@ static int read_ax25(char *s, int size) int declen; struct termios termios; - if ((len = read(0, s, size)) < 0) + len = read(0, s, size); + if (len < 0) return len; if (huffman) { @@ -990,7 +991,8 @@ static void cleanup(char *tty) gettimeofday(&tv, NULL); ut_line->ut_tv.tv_sec = tv.tv_sec; ut_line->ut_tv.tv_usec = tv.tv_usec; - if ((fp = fopen(_PATH_WTMP, "r+")) != NULL) { + fp = fopen(_PATH_WTMP, "r+"); + if (fp != NULL) { fseek(fp, 0L, SEEK_END); if (fwrite(ut_line, sizeof(ut), 1, fp) != 1) syslog(LOG_ERR, "Ooops, I think I've just barbecued your wtmp file\n"); @@ -1270,7 +1272,8 @@ static void read_config(void) while (!feof(fp)) { fgets(buf, sizeof(buf), fp); - if ((p = strchr(buf, '#')) || (p = strchr(buf, '\n'))) + p = strchr(buf, '#'); + if (p || (p = strchr(buf, '\n'))) *p='\0'; if (buf[0] != '\0') @@ -1548,7 +1551,8 @@ int main(int argc, char **argv) char *p_buf; sprintf(buf, "Login (%s): ", user); write_ax25(buf, strlen(buf), 1); - if ((cnt = read_ax25(buf, sizeof(buf)-1)) < 0) + cnt = read_ax25(buf, sizeof(buf) - 1); + if (cnt < 0) exit(1); buf[cnt] = 0; |