]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
tc: replace left side comparison
authorStephen Hemminger <stephen@networkplumber.org>
Thu, 24 Jan 2019 20:30:14 +0000 (09:30 +1300)
committerDavid Ahern <dsahern@gmail.com>
Mon, 28 Jan 2019 16:51:03 +0000 (08:51 -0800)
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>
Signed-off-by: David Ahern <dsahern@gmail.com>
tc/m_action.c
tc/m_ipt.c
tc/m_xt_old.c
tc/tc_util.c

index d5fd5affe7039d43a90dfe5ef47fb01f56a5774c..b5aff3ab4896d4055f7683434cc9f6140ec7cbcb 100644 (file)
@@ -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");
index b48cc0a9c85f93e78b7b7ab5287098a117d2bfae..1d73cb98895a363943831bf1ac1f972e13268521 100644 (file)
@@ -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;
        }
index 313bea61cc7e05bb8ed24168b48dd320c63a31bb..25d3677857868b3b84a08a5ae8de18533c5d10c6 100644 (file)
@@ -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;
        }
index ab717890bb2a44b4c53a756bd8350b4ed4428a22..1dfdae141f4d0c2a1b631c3a768d8e1b31dad7a4 100644 (file)
@@ -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;
        }