- if (strcmp(e_route_cnt->dst_gateway, dst)) {
- double latency_dst;
- xbt_dynar_t route_dst;
-
- _get_route_latency(e_route_cnt->dst_gateway, dst,
- (route ? &route_dst : NULL),
- (latency ? &latency_dst : NULL));
- if (route) {
- xbt_assert(route_dst, "no route between \"%s\" and \"%s\"",
- e_route_cnt->dst_gateway, dst);
- xbt_dynar_foreach(route_dst, cpt, link) {
- xbt_dynar_push(*route, &link);
- }
- xbt_dynar_free(&route_dst);
- }
- if (latency) {
- xbt_assert(latency_dst >= 0.0,
- "latency error on route between \"%s\" and \"%s\"",
- e_route_cnt->dst_gateway, dst);
- *latency += latency_dst;
- }
- }
-
- generic_free_extended_route(e_route_cnt);
- }
-}
-
-/**
- * \brief Generic function for get_route, get_route_no_cleanup, and get_latency
- */
-static void get_route_latency(const char *src, const char *dst,
- xbt_dynar_t * route, double *latency, int cleanup)
-{
- _get_route_latency(src, dst, route, latency);
- xbt_assert(!route || *route, "no route between \"%s\" and \"%s\"", src, dst);
- xbt_assert(!latency || *latency >= 0.0,
- "latency error on route between \"%s\" and \"%s\"", src, dst);
- if (route) {
- xbt_dynar_free(&global_routing->last_route);
- global_routing->last_route = cleanup ? *route : NULL;
- }
-}
-
-/**
- * \brief Generic method: find a route between hosts
- *
- * \param src the source host name
- * \param dst the destination host name
- *
- * walk through the routing components tree and find a route between hosts
- * by calling the differents "get_route" functions in each routing component.
- * No need to free the returned dynar. It will be freed at the next call.
- */
-static xbt_dynar_t get_route(const char *src, const char *dst)
-{
- xbt_dynar_t route = NULL;
- get_route_latency(src, dst, &route, NULL, 1);
- return route;
-}