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 /tcpip/rip98d.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 'tcpip/rip98d.c')
-rw-r--r-- | tcpip/rip98d.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/tcpip/rip98d.c b/tcpip/rip98d.c index 4b7be6b..c0543d0 100644 --- a/tcpip/rip98d.c +++ b/tcpip/rip98d.c @@ -180,7 +180,8 @@ static int read_routes(void) first_route = NULL; } - if ((fp = fopen(PROC_IP_ROUTE_FILE, "r")) == NULL) { + fp = fopen(PROC_IP_ROUTE_FILE, "r"); + if (fp == NULL) { if (logging) syslog(LOG_ERR, "error cannot open %s\n", PROC_IP_ROUTE_FILE); return FALSE; @@ -213,7 +214,8 @@ static int read_routes(void) } } - if ((route = malloc(sizeof(struct route_struct))) == NULL) { + route = malloc(sizeof(struct route_struct)); + if (route == NULL) { if (logging) syslog(LOG_ERR, "out of memory !\n"); return FALSE; @@ -239,15 +241,18 @@ static int load_dests(void) char buffer[255], *s; FILE *fp; - if ((fp = fopen(CONF_RIP98D_FILE, "r")) == NULL) { + fp = fopen(CONF_RIP98D_FILE, "r"); + if (fp == NULL) { fprintf(stderr, "rip98d: cannot open config file\n"); return FALSE; } while (fgets(buffer, 255, fp) != NULL) { - if ((s = strchr(buffer, '\n')) != NULL) *s = '\0'; + s = strchr(buffer, '\n'); + if (s != NULL) *s = '\0'; - if ((host = gethostbyname(buffer)) == NULL) { + host = gethostbyname(buffer); + if (host == NULL) { fprintf(stderr, "rip98d: cannot resolve name %s\n", buffer); fclose(fp); return FALSE; @@ -311,7 +316,8 @@ int main(int argc, char **argv) signal(SIGTERM, terminate); - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { perror("rip98d: socket"); return 1; } |