netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: netdev@vger.kernel.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2-next 2/2] tc: replace left side comparison
Date: Fri, 25 Jan 2019 09:30:14 +1300	[thread overview]
Message-ID: <20190124203014.7450-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20190124203014.7450-1-stephen@networkplumber.org>

The kernel (and iproute2) don't use the if (NULL == x) style
and instead prefer if (!x)

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 tc/m_action.c | 2 +-
 tc/m_ipt.c    | 3 +--
 tc/m_xt_old.c | 3 +--
 tc/tc_util.c  | 2 +-
 4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/tc/m_action.c b/tc/m_action.c
index d5fd5affe703..b5aff3ab4896 100644
--- a/tc/m_action.c
+++ b/tc/m_action.c
@@ -363,7 +363,7 @@ tc_print_action(FILE *f, const struct rtattr *arg, unsigned short tot_acts)
 
 	parse_rtattr_nested(tb, tot_acts, arg);
 
-	if (tab_flush && NULL != tb[0]  && NULL == tb[1])
+	if (tab_flush && tb[0] && !tb[1])
 		return tc_print_action_flush(f, tb[0]);
 
 	open_json_array(PRINT_JSON, "actions");
diff --git a/tc/m_ipt.c b/tc/m_ipt.c
index b48cc0a9c85f..1d73cb98895a 100644
--- a/tc/m_ipt.c
+++ b/tc/m_ipt.c
@@ -299,9 +299,8 @@ static int parse_ipt(struct action_util *a, int *argc_p,
 		int i;
 
 		for (i = 0; i < rargc; i++) {
-			if (NULL == argv[i] || 0 == strcmp(argv[i], "action")) {
+			if (!argv[i] || strcmp(argv[i], "action") == 0)
 				break;
-			}
 		}
 		iargc = argc = i;
 	}
diff --git a/tc/m_xt_old.c b/tc/m_xt_old.c
index 313bea61cc7e..25d367785786 100644
--- a/tc/m_xt_old.c
+++ b/tc/m_xt_old.c
@@ -224,9 +224,8 @@ static int parse_ipt(struct action_util *a, int *argc_p,
 		int i;
 
 		for (i = 0; i < rargc; i++) {
-			if (NULL == argv[i] || 0 == strcmp(argv[i], "action")) {
+			if (!argv[i] || strcmp(argv[i], "action") == 0)
 				break;
-			}
 		}
 		iargc = argc = i;
 	}
diff --git a/tc/tc_util.c b/tc/tc_util.c
index ab717890bb2a..1dfdae141f4d 100644
--- a/tc/tc_util.c
+++ b/tc/tc_util.c
@@ -857,7 +857,7 @@ void print_tcstats_attr(FILE *fp, struct rtattr *tb[], char *prefix, struct rtat
 
 	if (tb[TCA_STATS2]) {
 		print_tcstats2_attr(fp, tb[TCA_STATS2], prefix, xstats);
-		if (xstats && NULL == *xstats)
+		if (xstats && !*xstats)
 			goto compat_xstats;
 		return;
 	}
-- 
2.17.1


  reply	other threads:[~2019-01-24 20:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24 20:30 [PATCH iproute2-next 1/2] tc: replace print_string with fprintf for error messages Stephen Hemminger
2019-01-24 20:30 ` Stephen Hemminger [this message]
2019-01-28 16:51   ` [PATCH iproute2-next 2/2] tc: replace left side comparison David Ahern
2019-01-28 16:53 ` [PATCH iproute2-next 1/2] tc: replace print_string with fprintf for error messages David Ahern

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=20190124203014.7450-2-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).