summaryrefslogtreecommitdiffstats
path: root/netrom/netromr.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 /netrom/netromr.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 'netrom/netromr.c')
-rw-r--r--netrom/netromr.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/netrom/netromr.c b/netrom/netromr.c
index 63ac2bd..ccf6cd2 100644
--- a/netrom/netromr.c
+++ b/netrom/netromr.c
@@ -73,7 +73,8 @@ static int add_node(int s, unsigned char *buffer, struct nr_route_struct *nr_nod
best_quality = buffer[20];
nr_node->mnemonic[MNEMONIC_LEN] = '\0';
- if ((p = strchr(nr_node->mnemonic, ' ')) != NULL)
+ p = strchr(nr_node->mnemonic, ' ');
+ if (p != NULL)
*p = '\0';
if (!validcallsign(&nr_node->callsign)) {
@@ -147,7 +148,8 @@ void receive_nodes(unsigned char *buffer, int length, ax25_address *neighbour, i
sprintf(neigh_buffer, "%s/obsolescence_count_initialiser", PROC_NR_SYSCTL_DIR);
- if ((fp = fopen(neigh_buffer, "r")) == NULL) {
+ fp = fopen(neigh_buffer, "r");
+ if (fp == NULL) {
if (logging)
syslog(LOG_ERR, "netromr: cannot open %s\n", neigh_buffer);
return;
@@ -159,13 +161,15 @@ void receive_nodes(unsigned char *buffer, int length, ax25_address *neighbour, i
fclose(fp);
- if ((s = socket(AF_NETROM, SOCK_SEQPACKET, 0)) < 0) {
+ s = socket(AF_NETROM, SOCK_SEQPACKET, 0);
+ if (s < 0) {
if (logging)
syslog(LOG_ERR, "netromr: socket: %m");
return;
}
- if ((fp = fopen(PROC_NR_NEIGH_FILE, "r")) == NULL) {
+ fp = fopen(PROC_NR_NEIGH_FILE, "r");
+ if (fp == NULL) {
if (logging)
syslog(LOG_ERR, "netromr: cannot open %s\n", PROC_NR_NEIGH_FILE);
close(s);
@@ -199,7 +203,8 @@ void receive_nodes(unsigned char *buffer, int length, ax25_address *neighbour, i
memcpy(nr_node.mnemonic, buffer, MNEMONIC_LEN);
nr_node.mnemonic[MNEMONIC_LEN] = '\0';
- if ((p = strchr(nr_node.mnemonic, ' ')) != NULL)
+ p = strchr(nr_node.mnemonic, ' ');
+ if (p != NULL)
*p = '\0';
if (!validmnemonic(nr_node.mnemonic)) {