[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190124203014.7450-2-stephen@networkplumber.org>
Date: Fri, 25 Jan 2019 09:30:14 +1300
From: Stephen Hemminger <stephen@...workplumber.org>
To: netdev@...r.kernel.org
Cc: Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH iproute2-next 2/2] tc: replace left side comparison
The kernel (and iproute2) don't use the if (NULL == x) style
and instead prefer if (!x)
Signed-off-by: Stephen Hemminger <stephen@...workplumber.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
Powered by blists - more mailing lists