From daba307035faf4cc01f1ccb883b21281d91234cc Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Fri, 28 Jul 2017 14:10:07 +0200 Subject: 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 --- ax25/axspawn.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'ax25/axspawn.c') 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; -- cgit v1.2.3