Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
This looks unused since 2009 (commit b036991). Remove it.
[simgrid.git] / src / surf / surf_routing.c
index 683f037..ec7334f 100644 (file)
@@ -1,10 +1,11 @@
-/* Copyright (c) 2009, 2010, 2011. The SimGrid Team.
+/* Copyright (c) 2009-2013. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "simgrid/platf_interface.h"    // platform creation API internal interface
+#include "simgrid/sg_config.h"
 
 #include "surf_routing_private.h"
 #include "surf/surf_routing.h"
@@ -319,8 +320,6 @@ static void routing_parse_trace_connect(sg_platf_trace_connect_cbarg_t trace_con
   }
 }
 
-extern int _sg_init_status; /* yay, this is an horrible hack */
-
 /**
  * \brief Make a new routing component to the platform
  *
@@ -344,7 +343,9 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS)
              (as_router_lib, AS->id, ROUTING_ASR_LEVEL),
              "The AS \"%s\" already exists", AS->id);
 
-  _sg_init_status = 2; /* horrible hack: direct access to the global controlling the level of configuration to prevent any further config */
+  _sg_cfg_init_status = 2; /* horrible hack: direct access to the global
+                            * controlling the level of configuration to prevent
+                            * any further config */
 
   /* search the routing model */
   switch(AS->routing){
@@ -746,9 +747,6 @@ static void routing_parse_cabinet(sg_platf_cabinet_cbarg_t cabinet)
     s_sg_platf_host_cbarg_t host;
     memset(&host, 0, sizeof(host));
     host.initial_state = SURF_RESOURCE_ON;
-    xbt_dynar_t power_state_list = xbt_dynar_new(sizeof(double), NULL);
-    xbt_dynar_push(power_state_list,&cabinet->power);
-    host.power_peak = power_state_list;
     host.pstate = 0;
     host.power_scale = 1.0;
     host.core_amount = 1;
@@ -768,6 +766,9 @@ static void routing_parse_cabinet(sg_platf_cabinet_cbarg_t cabinet)
       link_id = bprintf("link_%s%d%s",cabinet->prefix,i,cabinet->suffix);
       host.id = host_id;
       link.id = link_id;
+      xbt_dynar_t power_state_list = xbt_dynar_new(sizeof(double), NULL);
+      xbt_dynar_push(power_state_list,&cabinet->power);
+      host.power_peak = power_state_list;
       sg_platf_new_host(&host);
       sg_platf_new_link(&link);
 
@@ -1079,6 +1080,7 @@ static void routing_parse_peer(sg_platf_peer_cbarg_t peer)
   XBT_DEBUG(" ");
 
   //xbt_dynar_free(&tab_elements_num);
+  free(router_id);
   free(host_id);
   free(link_id);
   free(link_up);