From d08f3360f435f17590416857a95fa9ccfe19204c Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Fri, 28 Jul 2017 14:26:57 +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 files: @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 --- ax25rtd/config.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'ax25rtd/config.c') diff --git a/ax25rtd/config.c b/ax25rtd/config.c index a483a15..a0d56b6 100644 --- a/ax25rtd/config.c +++ b/ax25rtd/config.c @@ -132,7 +132,8 @@ static ax25_address *get_mycall(char *port) { char *addr; - if ((addr = ax25_config_get_addr(port)) == NULL) + addr = ax25_config_get_addr(port); + if (addr == NULL) return NULL; return asc2ax(addr); @@ -146,7 +147,8 @@ static void load_ports(void) struct ifreq ifr, *ifrp; int k, fd; - if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + fd = socket(AF_INET, SOCK_DGRAM, 0); + if (fd < 0) { fprintf(stderr, "Unable to open socket\n"); exit(1); } @@ -557,13 +559,17 @@ void interpret_command(int fd, char *buf) if (!strcmp(cmd, "add")) { if (arg == NULL) return; - if ((arg2 = get_next_arg(&p)) == NULL) + arg2 = get_next_arg(&p); + if (arg2 == NULL) return; - if ((dev = get_next_arg(&p)) == NULL) + dev = get_next_arg(&p); + if (dev == NULL) return; - if ((time = get_next_arg(&p)) == NULL) + time = get_next_arg(&p); + if (time == NULL) return; - if ((config = dev_get_config(dev)) == NULL) + config = dev_get_config(dev); + if (config == NULL) return; sscanf(time, "%lx", &stamp); @@ -588,10 +594,12 @@ void interpret_command(int fd, char *buf) } else if (!strcmp(arg, "ip")) { ip = asc2ip(arg2); - if ((arg2 = get_next_arg(&p)) == NULL) + arg2 = get_next_arg(&p); + if (arg2 == NULL) return; - if ((arg = get_next_arg(&p)) == NULL) + arg = get_next_arg(&p); + if (arg == NULL) return; if (*arg == 'x') -- cgit v1.2.3