summaryrefslogtreecommitdiffstats
path: root/ax25/beacon.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2017-07-28 14:10:07 +0200
committerRalf Baechle <ralf@linux-mips.org>2017-07-31 04:29:44 +0200
commitdaba307035faf4cc01f1ccb883b21281d91234cc (patch)
treeedbd5df9285303f281524fac8064866057ce35ce /ax25/beacon.c
parent71b0582584ac5de97141ea207ddf17f7c938b2df (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 'ax25/beacon.c')
-rw-r--r--ax25/beacon.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/ax25/beacon.c b/ax25/beacon.c
index d4f39c7..79e918c 100644
--- a/ax25/beacon.c
+++ b/ax25/beacon.c
@@ -106,7 +106,8 @@ int main(int argc, char *argv[])
return 1;
}
- if ((portcall = ax25_config_get_addr(port)) == NULL) {
+ portcall = ax25_config_get_addr(port);
+ if (portcall == NULL) {
fprintf(stderr, "beacon: invalid AX.25 port setting - %s\n", port);
return 1;
}
@@ -121,7 +122,8 @@ int main(int argc, char *argv[])
if (addr == NULL)
return 1;
- if ((dlen = ax25_aton(addr, &dest)) == -1) {
+ dlen = ax25_aton(addr, &dest);
+ if (dlen == -1) {
fprintf(stderr, "beacon: unable to convert callsign '%s'\n", addr);
return 1;
}
@@ -131,15 +133,18 @@ int main(int argc, char *argv[])
}
if (srccall != NULL && strcmp(srccall, portcall) != 0) {
- if ((addr = malloc(strlen(srccall) + 1 + strlen(portcall) + 1)) == NULL)
+ addr = malloc(strlen(srccall) + 1 + strlen(portcall) + 1);
+ if (addr == NULL)
return 1;
sprintf(addr, "%s %s", srccall, portcall);
} else {
- if ((addr = strdup(portcall)) == NULL)
+ addr = strdup(portcall);
+ if (addr == NULL)
return 1;
}
- if ((len = ax25_aton(addr, &src)) == -1) {
+ len = ax25_aton(addr, &src);
+ if (len == -1) {
fprintf(stderr, "beacon: unable to convert callsign '%s'\n", addr);
return 1;
}
@@ -171,7 +176,8 @@ int main(int argc, char *argv[])
sleep(t_sleep);
}
- if ((s = socket(AF_AX25, SOCK_DGRAM, 0)) == -1) {
+ s = socket(AF_AX25, SOCK_DGRAM, 0);
+ if (s == -1) {
if (logging) {
syslog(LOG_ERR, "socket: %m");
closelog();