Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill LinkPtr type and make Link* explicit
[simgrid.git] / src / surf / surf_routing_floyd.cpp
index 18d3c9e..a2c35f8 100644 (file)
@@ -33,22 +33,25 @@ AsFloyd::~AsFloyd(){
   int i, j;
   int table_size;
   table_size = (int)xbt_dynar_length(p_indexNetworkElm);
-    /* Delete link_table */
-    for (i = 0; i < table_size; i++)
-      for (j = 0; j < table_size; j++)
-        generic_free_route(TO_FLOYD_LINK(i, j));
-    xbt_free(p_linkTable);
-    /* Delete bypass dict */
-    xbt_dict_free(&p_bypassRoutes);
-    /* Delete predecessor and cost table */
-    xbt_free(p_predecessorTable);
-    xbt_free(p_costTable);
+  if (p_linkTable == NULL) // Dealing with a parse error in the file?
+         return;
+  /* Delete link_table */
+  for (i = 0; i < table_size; i++)
+         for (j = 0; j < table_size; j++) {
+                 generic_free_route(TO_FLOYD_LINK(i, j));
+         }
+  xbt_free(p_linkTable);
+  /* Delete bypass dict */
+  xbt_dict_free(&p_bypassRoutes);
+  /* Delete predecessor and cost table */
+  xbt_free(p_predecessorTable);
+  xbt_free(p_costTable);
 }
 
 /* Business methods */
 xbt_dynar_t AsFloyd::getOneLinkRoutes()
 {
-  xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free);
+  xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free_f);
   sg_platf_route_cbarg_t route =   xbt_new0(s_sg_platf_route_cbarg_t, 1);
   route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
 
@@ -121,7 +124,7 @@ void AsFloyd::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_plat
     xbt_dynar_foreach(links, cpt, link) {
       xbt_dynar_push_as(res->link_list, sg_routing_link_t, link);
       if (lat)
-        *lat += static_cast<NetworkLinkPtr>(link)->getLatency();
+        *lat += static_cast<Link*>(link)->getLatency();
     }
 
     prev_dst_gw = e_route->gw_dst;