* This function is called by "get_route" and "get_latency". It allows to walk
* recursively through the routing components tree.
*/
-static void _get_route_latency(const char *src, const char *dst,
- xbt_dynar_t * route, double *latency)
+static void _get_route_and_latency(const char *src, const char *dst,
+ xbt_dynar_t * route, double *latency)
{
XBT_DEBUG("Solve route/latency \"%s\" to \"%s\"", src, dst);
xbt_assert(src && dst, "bad parameters for \"_get_route_latency\" method");
double latency_src;
xbt_dynar_t route_src;
- _get_route_latency(src, e_route_cnt->src_gateway,
+ _get_route_and_latency(src, e_route_cnt->src_gateway,
(route ? &route_src : NULL),
(latency ? &latency_src : NULL));
if (route) {
double latency_dst;
xbt_dynar_t route_dst;
- _get_route_latency(e_route_cnt->dst_gateway, dst,
+ _get_route_and_latency(e_route_cnt->dst_gateway, dst,
(route ? &route_dst : NULL),
(latency ? &latency_dst : NULL));
if (route) {
/**
* \brief Generic function for get_route, get_route_no_cleanup, and get_latency
*/
-static void get_route_latency(const char *src, const char *dst,
+void routing_get_route_and_latency(const char *src, const char *dst,
xbt_dynar_t * route, double *latency, int cleanup)
{
static xbt_dynar_t last_route = NULL;
- _get_route_latency(src, dst, route, latency);
+ _get_route_and_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);
*/
xbt_dynar_t routing_get_route(const char *src, const char *dst) {
xbt_dynar_t route = NULL;
- get_route_latency(src, dst, &route, NULL, 1);
+ routing_get_route_and_latency(src, dst, &route, NULL, 1);
return route;
}
static xbt_dynar_t get_route_no_cleanup(const char *src, const char *dst)
{
xbt_dynar_t route = NULL;
- get_route_latency(src, dst, &route, NULL, 0);
+ routing_get_route_and_latency(src, dst, &route, NULL, 0);
return route;
}
global_routing->root = NULL;
global_routing->get_route_no_cleanup = get_route_no_cleanup;
global_routing->get_onelink_routes = get_onelink_routes;
- global_routing->get_route_latency = get_route_latency;
global_routing->loopback = loopback;
global_routing->size_of_link = size_of_links;
/* no current routing at moment */
random_id, random->min, random->max, random->mean, random->std,
random->generator, random->seed, random_radical);
- if (xbt_dict_size(random_value) == 0)
+ if (!random_value)
random_value = xbt_dict_new();
if (!strcmp(random_radical, "")) {