]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd lib ospf6d pbrd tests zebra: shadowing fixes 3019/head
authorF. Aragon <paco@voltanet.io>
Thu, 13 Sep 2018 15:37:08 +0000 (17:37 +0200)
committerF. Aragon <paco@voltanet.io>
Thu, 13 Sep 2018 15:37:08 +0000 (17:37 +0200)
This fixes all remaining local variable shadowing cases

Signed-off-by: F. Aragon <paco@voltanet.io>
12 files changed:
bgpd/bgp_vty.c
bgpd/rfapi/bgp_rfapi_cfg.c
bgpd/rfapi/vnc_import_bgp.c
lib/plist.c
lib/termtable.c
lib/vrf.h
lib/zebra.h
ospf6d/ospf6d.h
pbrd/pbr_nht.c
tests/lib/cli/test_commands.c
tests/lib/test_srcdest_table.c
zebra/interface.c

index 3669ea7736184fe73dd103391e32b7591a086bde..e6c7ebd45f6f3b9d0bbc2bdfda6aca80b6de152e 100644 (file)
@@ -7367,7 +7367,7 @@ DEFUN (show_bgp_vrfs,
        for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) {
                const char *name, *type;
                struct peer *peer;
-               struct listnode *node, *nnode;
+               struct listnode *node2, *nnode2;
                int peers_cfg, peers_estb;
                json_object *json_vrf = NULL;
 
@@ -7387,7 +7387,7 @@ DEFUN (show_bgp_vrfs,
                        json_vrf = json_object_new_object();
 
 
-               for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
+               for (ALL_LIST_ELEMENTS(bgp->peer, node2, nnode2, peer)) {
                        if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE))
                                continue;
                        peers_cfg++;
index f1dd08fda0825c12cb9c1f585ffad107e8980fbc..15e39742480302716e5f52a2b2bf60fa2e7f3a8f 100644 (file)
@@ -4015,21 +4015,21 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
                        vty_out(vty, "!\n");
 
                if (hc->l2_groups) {
-                       struct rfapi_l2_group_cfg *rfg = NULL;
+                       struct rfapi_l2_group_cfg *rfgc = NULL;
                        struct listnode *gnode;
-                       for (ALL_LIST_ELEMENTS_RO(hc->l2_groups, gnode, rfg)) {
+                       for (ALL_LIST_ELEMENTS_RO(hc->l2_groups, gnode, rfgc)) {
                                struct listnode *lnode;
                                void *data;
                                ++write;
-                               vty_out(vty, " vnc l2-group %s\n", rfg->name);
-                               if (rfg->logical_net_id != 0)
+                               vty_out(vty, " vnc l2-group %s\n", rfgc->name);
+                               if (rfgc->logical_net_id != 0)
                                        vty_out(vty,
                                                "   logical-network-id %u\n",
-                                               rfg->logical_net_id);
-                               if (rfg->labels != NULL
-                                   && listhead(rfg->labels) != NULL) {
+                                               rfgc->logical_net_id);
+                               if (rfgc->labels != NULL
+                                   && listhead(rfgc->labels) != NULL) {
                                        vty_out(vty, "   labels ");
-                                       for (ALL_LIST_ELEMENTS_RO(rfg->labels,
+                                       for (ALL_LIST_ELEMENTS_RO(rfgc->labels,
                                                                  lnode,
                                                                  data)) {
                                                vty_out(vty, "%hu ",
@@ -4040,28 +4040,28 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
                                        vty_out(vty, "\n");
                                }
 
-                               if (rfg->rt_import_list && rfg->rt_export_list
-                                   && ecommunity_cmp(rfg->rt_import_list,
-                                                     rfg->rt_export_list)) {
+                               if (rfgc->rt_import_list && rfgc->rt_export_list
+                                   && ecommunity_cmp(rfgc->rt_import_list,
+                                                     rfgc->rt_export_list)) {
                                        char *b = ecommunity_ecom2str(
-                                               rfg->rt_import_list,
+                                               rfgc->rt_import_list,
                                                ECOMMUNITY_FORMAT_ROUTE_MAP,
                                                ECOMMUNITY_ROUTE_TARGET);
                                        vty_out(vty, "   rt both %s\n", b);
                                        XFREE(MTYPE_ECOMMUNITY_STR, b);
                                } else {
-                                       if (rfg->rt_import_list) {
+                                       if (rfgc->rt_import_list) {
                                                char *b = ecommunity_ecom2str(
-                                                       rfg->rt_import_list,
+                                                       rfgc->rt_import_list,
                                                        ECOMMUNITY_FORMAT_ROUTE_MAP,
                                                        ECOMMUNITY_ROUTE_TARGET);
                                                vty_out(vty, "  rt import %s\n",
                                                        b);
                                                XFREE(MTYPE_ECOMMUNITY_STR, b);
                                        }
-                                       if (rfg->rt_export_list) {
+                                       if (rfgc->rt_export_list) {
                                                char *b = ecommunity_ecom2str(
-                                                       rfg->rt_export_list,
+                                                       rfgc->rt_export_list,
                                                        ECOMMUNITY_FORMAT_ROUTE_MAP,
                                                        ECOMMUNITY_ROUTE_TARGET);
                                                vty_out(vty, "  rt export %s\n",
@@ -4074,7 +4074,7 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
                                                          .cfg_group_cb)(
                                                vty, bgp->rfapi->rfp,
                                                RFAPI_RFP_CFG_GROUP_L2,
-                                               rfg->name, rfg->rfp_cfg);
+                                               rfgc->name, rfgc->rfp_cfg);
                                vty_out(vty, "   exit-vnc\n");
                                vty_out(vty, "!\n");
                        }
index dc37ff89b50d3ca03bc491d713c55661478cab61..74dc20a93c76035404100c21df76e5fe64bb4061 100644 (file)
@@ -2398,11 +2398,11 @@ void vnc_import_bgp_exterior_add_route_interior(
        }
        if (list_adopted) {
                struct listnode *node;
-               struct agg_node *bi_exterior;
+               struct agg_node *an_bi_exterior;
 
-               for (ALL_LIST_ELEMENTS_RO(list_adopted, node, bi_exterior)) {
+               for (ALL_LIST_ELEMENTS_RO(list_adopted, node, an_bi_exterior)) {
                        skiplist_delete(it->monitor_exterior_orphans,
-                                       bi_exterior, NULL);
+                                       an_bi_exterior, NULL);
                }
                list_delete_and_null(&list_adopted);
        }
index f8dd7df0be53b2102a9759b37b34cdc5e2c32a86..ee68fbc0f12bfa57fda07547ec33a0d264508a16 100644 (file)
@@ -1252,13 +1252,13 @@ static int vty_show_prefix_list_prefix(struct vty *vty, afi_t afi,
                        if (pentry->any)
                                vty_out(vty, "any");
                        else {
-                               struct prefix *p = &pentry->prefix;
+                               struct prefix *pf = &pentry->prefix;
                                char buf[BUFSIZ];
 
                                vty_out(vty, "%s/%d",
-                                       inet_ntop(p->family, p->u.val, buf,
+                                       inet_ntop(pf->family, pf->u.val, buf,
                                                  BUFSIZ),
-                                       p->prefixlen);
+                                       pf->prefixlen);
 
                                if (pentry->ge)
                                        vty_out(vty, " ge %d", pentry->ge);
index 7bdb1ff873d2a79eba818b318d6f2a68eaa7eba0..4f5f9ff218ef724de1e9e40c3b6966b3c21d57ea 100644 (file)
@@ -140,8 +140,8 @@ static struct ttable_cell *ttable_insert_row_va(struct ttable *tt, int i,
        int ncols = 0;
 
        /* count how many columns we have */
-       for (int i = 0; format[i]; i++)
-               ncols += !!(format[i] == '|');
+       for (int j = 0; format[j]; j++)
+               ncols += !!(format[j] == '|');
        ncols++;
 
        if (tt->ncols == 0)
@@ -459,7 +459,7 @@ char *ttable_dump(struct ttable *tt, const char *newline)
                        memcpy(&buf[pos], left, lsize);
                        pos += lsize;
 
-                       for (size_t i = 0; i < width - lsize - rsize; i++)
+                       for (size_t l = 0; l < width - lsize - rsize; l++)
                                buf[pos++] = row[0].style.border.bottom;
 
                        pos -= width - lsize - rsize;
index c962ac4c6941f83d49b6a6681c7413395e82a64c..f0dabf5b244054eb9a6b5582c6f956b71b06c9e1 100644 (file)
--- a/lib/vrf.h
+++ b/lib/vrf.h
@@ -111,8 +111,8 @@ extern vrf_id_t vrf_name_to_id(const char *);
 
 #define VRF_GET_ID(V, NAME, USE_JSON)                                          \
        do {                                                                   \
-               struct vrf *vrf;                                               \
-               if (!(vrf = vrf_lookup_by_name(NAME))) {                       \
+               struct vrf *_vrf;                                              \
+               if (!(_vrf = vrf_lookup_by_name(NAME))) {                      \
                        if (USE_JSON) {                                        \
                                vty_out(vty, "{}\n");                          \
                        } else {                                               \
@@ -120,7 +120,7 @@ extern vrf_id_t vrf_name_to_id(const char *);
                        }                                                      \
                        return CMD_WARNING;                                    \
                }                                                              \
-               if (vrf->vrf_id == VRF_UNKNOWN) {                              \
+               if (_vrf->vrf_id == VRF_UNKNOWN) {                             \
                        if (USE_JSON) {                                        \
                                vty_out(vty, "{}\n");                          \
                        } else {                                               \
@@ -128,7 +128,7 @@ extern vrf_id_t vrf_name_to_id(const char *);
                        }                                                      \
                        return CMD_WARNING;                                    \
                }                                                              \
-               (V) = vrf->vrf_id;                                             \
+               (V) = _vrf->vrf_id;                                            \
        } while (0)
 
 /*
index d80aa06935500d11e032fea227ea8dcb2006bcb0..4e0e408ea639aab3586ea74d26467c2238a85c35 100644 (file)
@@ -333,18 +333,18 @@ struct in_pktinfo {
 #endif
 #define MAX(a, b)                                                              \
        ({                                                                     \
-               typeof(a) _a = (a);                                            \
-               typeof(b) _b = (b);                                            \
-               _a > _b ? _a : _b;                                             \
+               typeof(a) _max_a = (a);                                        \
+               typeof(b) _max_b = (b);                                        \
+               _max_a > _max_b ? _max_a : _max_b;                             \
        })
 #ifdef MIN
 #undef MIN
 #endif
 #define MIN(a, b)                                                              \
        ({                                                                     \
-               typeof(a) _a = (a);                                            \
-               typeof(b) _b = (b);                                            \
-               _a < _b ? _a : _b;                                             \
+               typeof(a) _min_a = (a);                                        \
+               typeof(b) _min_b = (b);                                        \
+               _min_a < _min_b ? _min_a : _min_b;                             \
        })
 
 #ifndef offsetof
index f95381084d0a93e0d06c4dcc8035aed7637aacf1..36f3c2233f77a8dced09fd94d240da8a1c55c622 100644 (file)
@@ -72,12 +72,12 @@ extern struct thread_master *master;
 
 #define threadtimer_string(now, t, buf, size)                                  \
        do {                                                                   \
-               struct timeval result;                                         \
+               struct timeval _result;                                        \
                if (!t)                                                        \
                        snprintf(buf, size, "inactive");                       \
                else {                                                         \
-                       timersub(&t->u.sands, &now, &result);                  \
-                       timerstring(&result, buf, size);                       \
+                       timersub(&t->u.sands, &now, &_result);                 \
+                       timerstring(&_result, buf, size);                      \
                }                                                              \
        } while (0)
 
index a8cefce84f1db0ed0ee37e5f8074d4e17aa62faf..7376e3e95bbd9b448740f27b4c093b9d518156b9 100644 (file)
@@ -586,13 +586,13 @@ struct pbr_nexthop_group_cache *pbr_nht_add_group(const char *name)
               pnhgc);
 
        for (ALL_NEXTHOPS(nhgc->nhg, nhop)) {
-               struct pbr_nexthop_cache lookup;
+               struct pbr_nexthop_cache lookupc;
                struct pbr_nexthop_cache *pnhc;
 
-               lookup.nexthop = nhop;
-               pnhc = hash_lookup(pnhgc->nhh, &lookup);
+               lookupc.nexthop = nhop;
+               pnhc = hash_lookup(pnhgc->nhh, &lookupc);
                if (!pnhc) {
-                       pnhc = hash_get(pnhgc->nhh, &lookup, pbr_nh_alloc);
+                       pnhc = hash_get(pnhgc->nhh, &lookupc, pbr_nh_alloc);
                        pnhc->parent = pnhgc;
                }
        }
index 2a8d263175a3a83fd8784c3054f333b84c2d3b69..a8b42ba789d8ae2043f84dff23b12defca32cddb 100644 (file)
@@ -265,10 +265,10 @@ static void test_run(struct prng *prng, struct vty *vty, const char *cmd,
                        if (descriptions != NULL) {
                                for (j = 0; j < vector_active(descriptions);
                                     j++) {
-                                       struct cmd_token *cmd =
+                                       struct cmd_token *ct =
                                                vector_slot(descriptions, j);
-                                       printf("  '%s' '%s'\n", cmd->text,
-                                              cmd->desc);
+                                       printf("  '%s' '%s'\n", ct->text,
+                                              ct->desc);
                                }
                                vector_free(descriptions);
                        }
index e717da15b34c44f69690267573905631ebcf8385..70db69aadf57f9e72b48d0c5e8b24342cf948f10 100644 (file)
@@ -289,7 +289,6 @@ static void test_state_verify(struct test_state *test)
                                expected_lock++;
 
                        if (rn->lock != expected_lock) {
-                               const struct prefix_ipv6 *dst_p, *src_p;
                                srcdest_rnode_prefixes(
                                        rn, (const struct prefix **)&dst_p,
                                        (const struct prefix **)&src_p);
index 488980c46f54c366130b42b8cbff00e9284df8d4..b4882edb9c867737f4088fa0cb701e0ac1052914 100644 (file)
@@ -2901,13 +2901,13 @@ static int link_params_config_write(struct vty *vty, struct interface *ifp)
 
 static int if_config_write(struct vty *vty)
 {
-       struct vrf *vrf;
+       struct vrf *vrf0;
        struct interface *ifp;
 
        zebra_ptm_write(vty);
 
-       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
-               FOR_ALL_INTERFACES (vrf, ifp) {
+       RB_FOREACH (vrf0, vrf_name_head, &vrfs_by_name)
+               FOR_ALL_INTERFACES (vrf0, ifp) {
                        struct zebra_if *if_data;
                        struct listnode *addrnode;
                        struct connected *ifc;