Browse Source

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.
Paul Jakma 2 years ago
parent
commit
5bc62ca956
5 changed files with 30 additions and 29 deletions
  1. 8 8
      bgpd/bgp_route.c
  2. 11 11
      bgpd/bgpd.c
  3. 4 3
      isisd/topology/spgrid.c
  4. 1 1
      ospf6d/ospf6_interface.c
  5. 6 6
      ospfd/ospf_abr.c

+ 8 - 8
bgpd/bgp_route.c

@@ -16221,14 +16221,14 @@ bgp_config_write_distance (struct vty *vty, struct bgp *bgp,
                  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 */
 

+ 11 - 11
bgpd/bgpd.c

@@ -3916,19 +3916,19 @@ peer_distribute_unset (struct peer *peer, afi_t afi, safi_t safi, int direct)
   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;
 }

+ 4 - 3
isisd/topology/spgrid.c

@@ -598,7 +598,7 @@ gen_spgrid_topology (struct vty *vty, struct list *topology)
     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 @@ gen_spgrid_topology (struct vty *vty, struct list *topology)
 
         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 */
     {

+ 1 - 1
ospf6d/ospf6_interface.c

@@ -681,7 +681,7 @@ interface_up (struct thread *thread)
       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 */

+ 6 - 6
ospfd/ospf_abr.c

@@ -701,7 +701,7 @@ ospf_abr_translate_nssa (struct ospf_area *area, struct ospf_lsa *lsa)
 	        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 @@ ospf_abr_announce_network (struct ospf *ospf,
             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);
         }
     }
 }