From daba307035faf4cc01f1ccb883b21281d91234cc Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Fri, 28 Jul 2017 14:10:07 +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 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 --- netrom/netromr.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'netrom/netromr.c') 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)) { -- cgit v1.2.3