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 --- listen/listen.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'listen/listen.c') 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 -- cgit v1.2.3