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 /listen | |
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 'listen')
-rw-r--r-- | listen/listen.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/listen/listen.c b/listen/listen.c index af4f19d..bf60708 100644 --- a/listen/listen.c +++ b/listen/listen.c @@ -36,7 +36,8 @@ static void display_port(char *dev) { char *port; - if ((port = ax25_config_get_name(dev)) == NULL) + port = ax25_config_get_name(dev); + if (port == NULL) port = dev; lprintf(T_PORT, "%s: ", port); @@ -262,14 +263,16 @@ int main(int argc, char **argv) fprintf(stderr, "listen: no AX.25 port data configured\n"); if (port != NULL) { - if ((dev = ax25_config_get_dev(port)) == NULL) { + dev = ax25_config_get_dev(port); + if (dev == NULL) { fprintf(stderr, "listen: invalid port name - %s\n", port); return 1; } } - if ((sock = socket(PF_PACKET, SOCK_PACKET, htons(proto))) == -1) { + sock = socket(PF_PACKET, SOCK_PACKET, htons(proto)); + if (sock == -1) { perror("socket"); return 1; } @@ -287,9 +290,8 @@ int main(int argc, char **argv) signal(SIGINT, handle_sigint); signal(SIGTERM, handle_sigint); - if ((size = - recvfrom(sock, buffer, sizeof(buffer), 0, &sa, - &asize)) == -1) { + size = recvfrom(sock, buffer, sizeof(buffer), 0, &sa, &asize); + if (size == -1) { /* * Signals are cared for by the handler, and we * don't want to abort on SIGWINCH |