isisd,ospf6d,bgpd: Fix GCC 6 warnings on indentation not matching control flow
GCC 6 can now give warnings when the indentation of code does not
align with the scope of prior control flow statement(s). I.e., where
the code visually suggests one kind of control flow, but in actuality
follows another.
Fix warnings found. They all seem to be simple cases of the indentation being
deceptive, but the existing flow being correct.
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 527d5d9..476ef05 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -16221,14 +16221,14 @@
bgp->ipv6_distance_ebgp, bgp->ipv6_distance_ibgp, bgp->ipv6_distance_local,
VTY_NEWLINE);
- for (rn = bgp_table_top (bgp_distance_table); rn; rn = bgp_route_next (rn))
- if ((bdistance = rn->info) != NULL)
- {
- vty_out (vty, " distance %d %s/%d %s%s", bdistance->distance,
- inet6_ntoa (rn->p.u.prefix6), rn->p.prefixlen,
- bdistance->access_list ? bdistance->access_list : "",
- VTY_NEWLINE);
- }
+ for (rn = bgp_table_top (bgp_distance_table); rn; rn = bgp_route_next (rn))
+ if ((bdistance = rn->info) != NULL)
+ {
+ vty_out (vty, " distance %d %s/%d %s%s", bdistance->distance,
+ inet6_ntoa (rn->p.u.prefix6), rn->p.prefixlen,
+ bdistance->access_list ? bdistance->access_list : "",
+ VTY_NEWLINE);
+ }
}
#endif /* HAVE_IPV6 */
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 69ab7da..6189411 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -3916,19 +3916,19 @@
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
return 0;
- group = peer->group;
- for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
- {
- filter = &peer->filter[afi][safi];
+ group = peer->group;
+ for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
+ {
+ filter = &peer->filter[afi][safi];
- if (! peer->af_group[afi][safi])
- continue;
+ if (! peer->af_group[afi][safi])
+ continue;
- if (filter->dlist[direct].name)
- free (filter->dlist[direct].name);
- filter->dlist[direct].name = NULL;
- filter->dlist[direct].alist = NULL;
- }
+ if (filter->dlist[direct].name)
+ free (filter->dlist[direct].name);
+ filter->dlist[direct].name = NULL;
+ filter->dlist[direct].alist = NULL;
+ }
return 0;
}
diff --git a/isisd/topology/spgrid.c b/isisd/topology/spgrid.c
index 22cfa7b..e1c87ab 100644
--- a/isisd/topology/spgrid.c
+++ b/isisd/topology/spgrid.c
@@ -598,7 +598,7 @@
init_rand ( seed1);
pl = pl - pm + 1;
- for ( x = 0; x < X; x ++ )
+ for ( x = 0; x < X; x ++ ) {
for ( y = 0; y < Y; y ++ ) {
p_t = pm + nrand ( pl );
if ( pn_f ) p_t *= (long) ( (1 + x) * pn );
@@ -606,9 +606,10 @@
p[ NODE ( x, y ) ] = p_t;
}
- p[n0] = 0;
- if ( s_f ) p[n0-1] = 0;
}
+ p[n0] = 0;
+ if ( s_f ) p[n0-1] = 0;
+ }
if ( s_f ) /* additional arcs from artifical source */
{
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index 14a93c8..fa6509f 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -681,7 +681,7 @@
if (IS_OSPF6_DEBUG_INTERFACE)
zlog_debug ("Interface %s has no link local address, can't execute [InterfaceUp]",
oi->interface->name);
- return 0;
+ return 0;
}
/* Recompute cost */
diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c
index e172e53..95c2d46 100644
--- a/ospfd/ospf_abr.c
+++ b/ospfd/ospf_abr.c
@@ -701,7 +701,7 @@
zlog_debug ("ospf_abr_translate_nssa(): Could not translate "
"Type-7 for %s to Type-5",
inet_ntoa (lsa->data->id));
- return 1;
+ return 1;
}
}
@@ -948,11 +948,11 @@
zlog_debug ("ospf_abr_announce_network(): "
"this is intra-area route to %s/%d",
inet_ntoa (p->prefix), p->prefixlen);
- if ((range = ospf_area_range_match (or_area, p))
- && !ospf_area_is_transit (area))
- ospf_abr_update_aggregate (range, or, area);
- else
- ospf_abr_announce_network_to_area (p, or->cost, area);
+ if ((range = ospf_area_range_match (or_area, p))
+ && !ospf_area_is_transit (area))
+ ospf_abr_update_aggregate (range, or, area);
+ else
+ ospf_abr_announce_network_to_area (p, or->cost, area);
}
}
}