From: Martin Quinson Date: Tue, 15 Nov 2011 01:06:53 +0000 (+0100) Subject: kill global_routing->get_route_no_cleanup() X-Git-Tag: exp_20120216~280 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/bdc99dddb4082e9c50525e5f7da24279cfd14c9f?ds=sidebyside kill global_routing->get_route_no_cleanup() use routing_get_route_and_latency(....., 0) instead --- diff --git a/src/surf/network_im.c b/src/surf/network_im.c index 2ee4babfed..a8c6e7f668 100644 --- a/src/surf/network_im.c +++ b/src/surf/network_im.c @@ -605,8 +605,9 @@ static surf_action_t im_net_communicate(const char *src_name, xbt_dynar_t back_route = NULL; int constraints_per_variable = 0; - // I will need this route for some time so let's call get_route_no_cleanup - xbt_dynar_t route = global_routing->get_route_no_cleanup(src_name, dst_name); + // I will need this route for some time so let's call get_route with 0 as last argument to preserve it + xbt_dynar_t route; + routing_get_route_and_latency(src_name, dst_name,&route,NULL,0); if (sg_network_fullduplex == 1) { diff --git a/src/surf/surf_private.h b/src/surf/surf_private.h index 99af1caff9..fc8e8dc40a 100644 --- a/src/surf/surf_private.h +++ b/src/surf/surf_private.h @@ -166,7 +166,6 @@ struct s_routing_global { AS_t root; void *loopback; size_t size_of_link; - xbt_dynar_t(*get_route_no_cleanup) (const char *src, const char *dst); xbt_dynar_t(*get_onelink_routes) (void); }; diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 61c0be47e4..5f3e5685f9 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -637,7 +637,6 @@ static void _get_route_and_latency(const char *src, const char *dst, * * 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. */ void routing_get_route_and_latency(const char *src, const char *dst, xbt_dynar_t * route, double *latency, int cleanup) @@ -654,23 +653,6 @@ void routing_get_route_and_latency(const char *src, const char *dst, } } -/** - * \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. - * Leaves the caller the responsability to clean the returned dynar. - */ -static xbt_dynar_t get_route_no_cleanup(const char *src, const char *dst) -{ - xbt_dynar_t route = NULL; - routing_get_route_and_latency(src, dst, &route, NULL, 0); - return route; -} - static xbt_dynar_t recursive_get_onelink_routes(AS_t rc) { xbt_dynar_t ret = xbt_dynar_new(sizeof(onelink_t), xbt_free); @@ -729,7 +711,6 @@ void routing_model_create(size_t size_of_links, void *loopback) /* config the uniq global routing */ global_routing = xbt_new0(s_routing_global_t, 1); global_routing->root = NULL; - global_routing->get_route_no_cleanup = get_route_no_cleanup; global_routing->get_onelink_routes = get_onelink_routes; global_routing->loopback = loopback; global_routing->size_of_link = size_of_links;