Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill global_routing->get_route_no_cleanup()
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 15 Nov 2011 01:06:53 +0000 (02:06 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 15 Nov 2011 01:06:53 +0000 (02:06 +0100)
use routing_get_route_and_latency(....., 0) instead

src/surf/network_im.c
src/surf/surf_private.h
src/surf/surf_routing.c

index 2ee4bab..a8c6e7f 100644 (file)
@@ -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;
 
   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) {
 
 
   if (sg_network_fullduplex == 1) {
index 99af1ca..fc8e8dc 100644 (file)
@@ -166,7 +166,6 @@ struct s_routing_global {
   AS_t root;
   void *loopback;
   size_t size_of_link;
   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);
 };
 
   xbt_dynar_t(*get_onelink_routes) (void);
 };
 
index 61c0be4..5f3e568 100644 (file)
@@ -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.
  *
  * 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)
  */
 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);
 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;
   /* 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;
   global_routing->get_onelink_routes = get_onelink_routes;
   global_routing->loopback = loopback;
   global_routing->size_of_link = size_of_links;