diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2017-07-28 14:26:57 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2017-08-03 03:46:12 +0200 |
commit | d08f3360f435f17590416857a95fa9ccfe19204c (patch) | |
tree | 0a3434ba7d43bd3d4be7081377f147da400268f1 /ax25rtd/config.c | |
parent | b541f5ddd8936a1f2fa69d1917d6812139da0c4e (diff) |
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 <ralf@linux-mips.org>
Diffstat (limited to 'ax25rtd/config.c')
-rw-r--r-- | ax25rtd/config.c | 24 |
1 files changed, 16 insertions, 8 deletions
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') |