Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Initialize another bunch of variables.
[simgrid.git] / src / surf / surf_routing_dijkstra.cpp
index d3ae335..f5f7206 100644 (file)
@@ -184,7 +184,7 @@ xbt_dynar_t AsDijkstra::getOnelinkRoutes()
 
   int src,dst;
   RoutingEdgePtr src_elm, dst_elm;
-  size_t table_size = xbt_dynar_length(p_indexNetworkElm);
+  int table_size = (int)xbt_dynar_length(p_indexNetworkElm);
   for(src=0; src < table_size; src++) {
     for(dst=0; dst< table_size; dst++) {
       xbt_dynar_reset(route->link_list);
@@ -409,10 +409,17 @@ AsDijkstra::~AsDijkstra()
 
 /* Creation routing model functions */
 
-AsDijkstra::AsDijkstra() : AsGeneric(), m_cached(0) {}
+AsDijkstra::AsDijkstra() : AsGeneric(), m_cached(0) {
+  p_routeGraph = NULL;
+  p_graphNodeMap = NULL;
+  p_routeCache = NULL;
+}
 
 AsDijkstra::AsDijkstra(int cached) : AsGeneric(), m_cached(cached)
 {
+  p_routeGraph = NULL;
+  p_graphNodeMap = NULL;
+  p_routeCache = NULL;
   /*new_component->generic_routing.parse_route = model_dijkstra_both_parse_route;
   new_component->generic_routing.parse_ASroute = model_dijkstra_both_parse_route;
   new_component->generic_routing.get_route_and_latency = dijkstra_get_route_and_latency;
@@ -435,7 +442,7 @@ void AsDijkstra::end()
   if(!p_graphNodeMap)
     p_graphNodeMap = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
 
-  if (m_cached && p_routeCache)
+  if (m_cached && !p_routeCache)
     p_routeCache = xbt_dict_new_homogeneous(&route_cache_elem_free);
 
   /* Add the loopback if needed */