]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tc: m_xt: Get rid of iargc variable in parse_ipt()
authorPhil Sutter <phil@nwl.cc>
Fri, 10 Jun 2016 11:42:06 +0000 (13:42 +0200)
committerStephen Hemminger <shemming@brocade.com>
Tue, 14 Jun 2016 21:35:56 +0000 (14:35 -0700)
After dropping the unused decrement of argc in the function's tail, it
can fully take over what iargc has been used for.

Signed-off-by: Phil Sutter <phil@nwl.cc>
tc/m_xt.c

index 61fc437dfc907761bb02f1af95c3a32f9be9e2ad..55ebadf2cf50a4a166497946514d31eb09e8ba99 100644 (file)
--- a/tc/m_xt.c
+++ b/tc/m_xt.c
@@ -124,7 +124,7 @@ static int parse_ipt(struct action_util *a, int *argc_p,
 
        int c;
        char **argv = *argv_p;
-       int argc = 0, iargc = 0;
+       int argc = 0;
        char k[16];
        int size = 0;
        int iok = 0, ok = 0;
@@ -144,7 +144,7 @@ static int parse_ipt(struct action_util *a, int *argc_p,
                                break;
                        }
                }
-               iargc = argc = i;
+               argc = i;
        }
 
        if (argc <= 2) {
@@ -205,7 +205,7 @@ static int parse_ipt(struct action_util *a, int *argc_p,
                }
        }
 
-       if (iargc > optind) {
+       if (argc > optind) {
                if (matches(argv[optind], "index") == 0) {
                        if (get_u32(&index, argv[optind + 1], 10)) {
                                fprintf(stderr, "Illegal \"index\"\n");
@@ -271,9 +271,8 @@ static int parse_ipt(struct action_util *a, int *argc_p,
                addattr_l(n, MAX_MSG, TCA_IPT_TARG, m->t, m->t->u.target_size);
        tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 
-       argc -= optind;
        argv += optind;
-       *argc_p -= iargc;
+       *argc_p -= argc;
        *argv_p = argv;
 
        optind = 0;