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 --- netrom/nrsdrv.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'netrom/nrsdrv.c') diff --git a/netrom/nrsdrv.c b/netrom/nrsdrv.c index 90b7635..a026cb8 100644 --- a/netrom/nrsdrv.c +++ b/netrom/nrsdrv.c @@ -321,7 +321,8 @@ int main(int argc, char *argv[]) logging = TRUE; break; case 's': - if ((speed = atoi(optarg)) <= 0) { + speed = atoi(optarg); + if (speed <= 0) { fprintf(stderr, "nrsdrv: invalid speed %s\n", optarg); return 1; } @@ -359,12 +360,14 @@ int main(int argc, char *argv[]) return 1; } - if ((kissfd = open(kissdev, O_RDWR)) == -1) { + kissfd = open(kissdev, O_RDWR); + if (kissfd == -1) { perror("nrsdrv: open kiss device"); return 1; } - if ((nrsfd = open(nrsdev, O_RDWR)) == -1) { + nrsfd = open(nrsdev, O_RDWR); + if (nrsfd == -1) { perror("nrsdrv: open nrs device"); return 1; } @@ -429,7 +432,8 @@ int main(int argc, char *argv[]) n = select(c, &read_fd, NULL, NULL, NULL); if (FD_ISSET(kissfd, &read_fd)) { - if ((n = read(kissfd, buffer, 512)) <= 0) { + n = read(kissfd, buffer, 512); + if (n <= 0) { if (logging) { syslog(LOG_INFO, "terminating on KISS device closure\n"); closelog(); @@ -440,7 +444,8 @@ int main(int argc, char *argv[]) } if (FD_ISSET(nrsfd, &read_fd)) { - if ((n = read(nrsfd, buffer, 512)) <= 0) { + n = read(nrsfd, buffer, 512); + if (n <= 0) { if (logging) { syslog(LOG_INFO, "terminating on NRS device closure\n"); closelog(); -- cgit v1.2.3