gateway: use standard macro to loop over the gateway tree in olsr_cleanup_gateways
authorFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 16 Jan 2013 16:37:11 +0000 (17:37 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 16 Jan 2013 18:12:13 +0000 (19:12 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/gateway.c

index 2d3ce97..1a16f21 100644 (file)
@@ -571,18 +571,17 @@ void olsr_shutdown_gateways(void) {
  * Cleanup gateway tunnel system
  */
 void olsr_cleanup_gateways(void) {
-  struct avl_node * avlnode = NULL;
+  struct gateway_entry * tree_gw;
   struct gw_container_entry * gw;
 
   olsr_remove_ifchange_handler(smartgw_tunnel_monitor);
 
   /* remove all gateways in the gateway tree that are not the active gateway */
-  while ((avlnode = avl_walk_first(&gateway_tree))) {
-    struct gateway_entry* tree_gw = node2gateway(avlnode);
+  OLSR_FOR_ALL_GATEWAY_ENTRIES(tree_gw) {
     if ((tree_gw != olsr_get_inet_gateway(false)) && (tree_gw != olsr_get_inet_gateway(true))) {
       olsr_delete_gateway_tree_entry(tree_gw, FORCE_DELETE_GW_ENTRY, true);
     }
-  }
+  } OLSR_FOR_ALL_GATEWAY_ENTRIES_END(gw)
 
   /* remove all active IPv4 gateways (should be at most 1 now) */
   OLSR_FOR_ALL_GWS(&gw_list_ipv4.head, gw) {