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_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;
xbt_dynar_t link_route_to_test = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
xbt_dynar_foreach(route->link_list,cpt,link_name)
{
- void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
+ void *link = Link::byName(link_name);
xbt_assert(link,"Link : '%s' doesn't exists.",link_name);
xbt_dynar_push(link_route_to_test,&link);
}
for(i=xbt_dynar_length(route->link_list) ;i>0 ;i--)
{
link_name = xbt_dynar_get_as(route->link_list,i-1,char *);
- void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
+ void *link = Link::byName(link_name);
xbt_assert(link,"Link : '%s' doesn't exists.",link_name);
xbt_dynar_push(link_route_to_test,&link);
}