Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix a bug
[simgrid.git] / src / surf / surf_routing_full.cpp
index 23b320f..02a5168 100644 (file)
@@ -5,11 +5,9 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "surf_routing_full.hpp"
-#include "network.hpp"
+#include "network_interface.hpp"
 
-extern "C" {
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
-}
 
 /* Global vars */
 extern routing_platf_t routing_platf;
@@ -60,8 +58,12 @@ AsFull::~AsFull(){
   int i, j;
   /* Delete routing table */
   for (i = 0; i < table_size; i++)
-    for (j = 0; j < table_size; j++)
-      xbt_free(TO_ROUTE_FULL(i,j));
+    for (j = 0; j < table_size; j++) {
+      if (TO_ROUTE_FULL(i,j)){
+        xbt_dynar_free(&TO_ROUTE_FULL(i,j)->link_list);
+        xbt_free(TO_ROUTE_FULL(i,j));
+      }
+    }
   xbt_free(p_routingTable);
 }
 
@@ -123,7 +125,7 @@ void AsFull::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf
     xbt_dynar_foreach(e_route->link_list, cpt, link) {
       xbt_dynar_push(res->link_list, &link);
       if (lat)
-        *lat += dynamic_cast<NetworkCm02LinkPtr>(static_cast<ResourcePtr>(link))->getLatency();
+        *lat += static_cast<NetworkLinkPtr>(link)->getLatency();
     }
   }
 }