Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill further globals
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 10 Nov 2011 16:33:46 +0000 (17:33 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 10 Nov 2011 17:44:53 +0000 (18:44 +0100)
src/surf/surf_private.h
src/surf/surf_routing.c
src/surf/surf_routing_dijkstra.c
src/surf/surf_routing_floyd.c
src/surf/surf_routing_full.c
src/surf/surf_routing_generic.c
src/surf/surf_routing_none.c
src/surf/surf_routing_private.h
src/surf/surf_routing_rulebased.c

index 0da0771..8739042 100644 (file)
@@ -107,7 +107,7 @@ typedef struct s_model_type {
   const char *name;
   const char *desc;
   AS_t (*create) ();
-  void (*end) ();
+  void (*end) (AS_t as);
 } s_routing_model_description_t, *routing_model_description_t;
 
 typedef struct s_route {
index 658d80c..fb5f324 100644 (file)
@@ -374,7 +374,7 @@ void routing_AS_end()
                 (void *) info);
 
     if (current_routing->routing->end)
-      (*(current_routing->routing->end)) ();
+      (*(current_routing->routing->end)) (current_routing);
     current_routing = current_routing->routing_father;
   }
 }
index 0c6c78c..442c965 100644 (file)
@@ -8,8 +8,6 @@
 
 /* Global vars */
 extern routing_global_t global_routing;
-extern AS_t current_routing;
-extern routing_model_description_t current_routing_model;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_dijkstra, surf, "Routing part of surf -- dijkstra routing logic");
 
@@ -462,30 +460,29 @@ AS_t model_dijkstracache_create(void)
   return model_dijkstra_both_create(1);
 }
 
-void model_dijkstra_both_end(void)
+void model_dijkstra_both_end(AS_t as)
 {
-  as_dijkstra_t routing =
-      (as_dijkstra_t) current_routing;
+  as_dijkstra_t THIS = (as_dijkstra_t) as;
 
   xbt_node_t node = NULL;
   unsigned int cursor2;
   xbt_dynar_t nodes = NULL;
 
   /* Create the topology graph */
-  if(!routing->route_graph)
-  routing->route_graph = xbt_graph_new_graph(1, NULL);
-  if(!routing->graph_node_map)
-  routing->graph_node_map = xbt_dict_new();
+  if(!THIS->route_graph)
+  THIS->route_graph = xbt_graph_new_graph(1, NULL);
+  if(!THIS->graph_node_map)
+  THIS->graph_node_map = xbt_dict_new();
 
-  if (routing->cached && !routing->route_cache)
-  routing->route_cache = xbt_dict_new();
+  if (THIS->cached && !THIS->route_cache)
+  THIS->route_cache = xbt_dict_new();
 
   /* Add the loopback if needed */
-  if (current_routing->hierarchy == SURF_ROUTING_BASE)
-    add_loopback_dijkstra(routing);
+  if (as->hierarchy == SURF_ROUTING_BASE)
+    add_loopback_dijkstra(THIS);
 
   /* initialize graph indexes in nodes after graph has been built */
-  nodes = xbt_graph_get_nodes(routing->route_graph);
+  nodes = xbt_graph_get_nodes(THIS->route_graph);
 
   xbt_dynar_foreach(nodes, cursor2, node) {
     graph_node_data_t data = xbt_graph_node_get_data(node);
@@ -529,6 +526,6 @@ void model_dijkstra_both_parse_route (AS_t asg, const char *src,
        }
 
        route_extended_t e_route =
-               generic_new_extended_route(current_routing->hierarchy, route, 1);
+               generic_new_extended_route(asg->hierarchy, route, 1);
        route_new_dijkstra(as, *src_id, *dst_id, e_route);
 }
index b441684..211cf92 100644 (file)
@@ -8,8 +8,6 @@
 
 /* Global vars */
 extern routing_global_t global_routing;
-extern AS_t current_routing;
-extern routing_model_description_t current_routing_model;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_floyd, surf, "Routing part of surf");
 
@@ -183,7 +181,7 @@ AS_t model_floyd_create(void)
   return (AS_t)new_component;
 }
 
-void model_floyd_end(void)
+void model_floyd_end(AS_t current_routing)
 {
 
        as_floyd_t as =
index 1b439de..15ef1e2 100644 (file)
@@ -8,8 +8,6 @@
 
 /* Global vars */
 extern routing_global_t global_routing;
-extern AS_t current_routing;
-extern routing_model_description_t current_routing_model;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
 
@@ -139,7 +137,7 @@ AS_t model_full_create(void)
   return (AS_t) new_component;
 }
 
-void model_full_end(void)
+void model_full_end(AS_t current_routing)
 {
   unsigned int i;
   route_extended_t e_route;
index 5b771d5..e99aa19 100644 (file)
@@ -14,8 +14,6 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing");
 
-extern AS_t current_routing;
-
 AS_t routmod_generic_create(size_t childsize) {
   AS_t new_component = xbt_malloc0(childsize);
 
@@ -38,22 +36,22 @@ AS_t routmod_generic_create(size_t childsize) {
 }
 
 
-void generic_parse_PU(AS_t rc, const char *name)
+void generic_parse_PU(AS_t as, const char *name)
 {
   XBT_DEBUG("Load process unit \"%s\"", name);
   int *id = xbt_new0(int, 1);
   xbt_dict_t _to_index;
-  _to_index = current_routing->to_index;
+  _to_index = as->to_index;
   *id = xbt_dict_length(_to_index);
   xbt_dict_set(_to_index, name, id, xbt_free);
 }
 
-void generic_parse_AS(AS_t rc, const char *name)
+void generic_parse_AS(AS_t as, const char *name)
 {
   XBT_DEBUG("Load Autonomous system \"%s\"", name);
   int *id = xbt_new0(int, 1);
   xbt_dict_t _to_index;
-  _to_index = current_routing->to_index;
+  _to_index = as->to_index;
   *id = xbt_dict_length(_to_index);
   xbt_dict_set(_to_index, name, id, xbt_free);
 }
index 21ed6cd..415f124 100644 (file)
@@ -8,8 +8,6 @@
 
 /* Global vars */
 extern routing_global_t global_routing;
-extern AS_t current_routing;
-extern routing_model_description_t current_routing_model;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_none, surf, "Routing part of surf");
 
index 311dbb7..7e7405a 100644 (file)
@@ -63,7 +63,7 @@ void generic_src_dst_check(AS_t rc, const char *src,
 /* ************************************************************************** */
 /* *************************** FLOYD ROUTING ******************************** */
 AS_t model_floyd_create(void);  /* create structures for floyd routing model */
-void model_floyd_end(void);      /* finalize the creation of floyd routing model */
+void model_floyd_end(AS_t as);      /* finalize the creation of floyd routing model */
 void model_floyd_parse_route(AS_t rc, const char *src,
         const char *dst, route_extended_t route);
 
@@ -90,14 +90,14 @@ AS_t model_vivaldi_create(void);      /* create structures for vivaldi routing m
 AS_t model_dijkstra_both_create(int cached);    /* create by calling dijkstra or dijkstracache */
 AS_t model_dijkstra_create(void);       /* create structures for dijkstra routing model */
 AS_t model_dijkstracache_create(void);  /* create structures for dijkstracache routing model */
-void model_dijkstra_both_end(void);      /* finalize the creation of dijkstra routing model */
+void model_dijkstra_both_end(AS_t as);      /* finalize the creation of dijkstra routing model */
 void model_dijkstra_both_parse_route (AS_t rc, const char *src,
                      const char *dst, route_extended_t route);
 
 /* ************************************************************************** */
 /* *************************** FULL ROUTING ********************************* */
 AS_t model_full_create(void);   /* create structures for full routing model */
-void model_full_end(void);       /* finalize the creation of full routing model */
+void model_full_end(AS_t as);       /* finalize the creation of full routing model */
 void model_full_set_route(     /* Set the route and ASroute between src and dst */
                AS_t rc, const char *src, const char *dst, route_extended_t route);
 
index 2e5a948..6e7a605 100644 (file)
@@ -8,8 +8,6 @@
 
 /* Global vars */
 extern routing_global_t global_routing;
-extern AS_t current_routing;
-extern routing_model_description_t current_routing_model;
 extern xbt_dynar_t link_list;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_rulebased, surf, "Routing part of surf");