From 6f1940da8ec18288560579c8114efb32fc2425f0 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 25 Jan 2019 09:30:14 +1300 Subject: [PATCH] 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 Signed-off-by: David Ahern --- 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 d5fd5aff..b5aff3ab 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 b48cc0a9..1d73cb98 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 313bea61..25d36778 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 ab717890..1dfdae14 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.39.2