Remove the assignment from if condition to follow kernel coding style
and make the code more clear and readable.

Signed-off-by: Arushi Singhal <[email protected]>
---
 iptables/getethertype.c | 3 ++-
 iptables/nft-arp.c      | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/iptables/getethertype.c b/iptables/getethertype.c
index bf3e408..11c121a 100644
--- a/iptables/getethertype.c
+++ b/iptables/getethertype.c
@@ -84,7 +84,8 @@ struct ethertypeent *getethertypeent(void)
        }
 
 again:
-       if ((e = fgets(line, BUFSIZ, etherf)) == NULL) {
+       e = fgets(line, BUFSIZ, etherf);
+       if (!e) {
                return (NULL);
        }
        if (*e == '#')
diff --git a/iptables/nft-arp.c b/iptables/nft-arp.c
index 0e13b8c..37ed956 100644
--- a/iptables/nft-arp.c
+++ b/iptables/nft-arp.c
@@ -70,7 +70,8 @@ addr_to_network(const struct in_addr *addr)
 {
        struct netent *net;
 
-       if ((net = getnetbyaddr((long) ntohl(addr->s_addr), AF_INET)) != NULL)
+       net = getnetbyaddr((long) ntohl(addr->s_addr), AF_INET);
+       if (net)
                return (char *) net->n_name;
 
        return (char *) NULL;
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to