All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arushi Singhal <arushisinghal19971997@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: Arushi Singhal <arushisinghal19971997@gmail.com>
Subject: [PATCH 2/4] iptables: iptables: Remove assignment in if condition
Date: Fri, 31 Mar 2017 21:43:49 +0530	[thread overview]
Message-ID: <20170331161351.26141-3-arushisinghal19971997@gmail.com> (raw)
In-Reply-To: <20170331161351.26141-1-arushisinghal19971997@gmail.com>

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

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
 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


  parent reply	other threads:[~2017-03-31 16:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 16:13 [PATCH 0/4] Multiple checkpatch issues Arushi Singhal
2017-03-31 16:13 ` [PATCH 1/4] iptables: iptables: Add blank line after declaration Arushi Singhal
2017-04-07 16:12   ` Pablo Neira Ayuso
2017-03-31 16:13 ` Arushi Singhal [this message]
2017-03-31 16:13 ` [PATCH 3/4] iptables: iptables: Indent the code Arushi Singhal
2017-03-31 16:13 ` [PATCH 4/4] iptables: iptables: switch and case should be at the same indent Arushi Singhal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170331161351.26141-3-arushisinghal19971997@gmail.com \
    --to=arushisinghal19971997@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.