Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
tiny function renaming
[simgrid.git] / src / surf / surf_routing.c
index 55d6ab2..3c055e2 100644 (file)
@@ -464,8 +464,8 @@ static void elements_father(const char *src, const char *dst,
  * 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");
@@ -534,7 +534,7 @@ static void _get_route_latency(const char *src, const char *dst,
       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) {
@@ -563,7 +563,7 @@ static void _get_route_latency(const char *src, const char *dst,
       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) {
@@ -589,12 +589,12 @@ static void _get_route_latency(const char *src, const char *dst,
 /**
  * \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);
@@ -616,7 +616,7 @@ static void get_route_latency(const char *src, const char *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;
 }
 
@@ -633,7 +633,7 @@ xbt_dynar_t routing_get_route(const char *src, const char *dst) {
 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;
 }
 
@@ -697,7 +697,6 @@ void routing_model_create(size_t size_of_links, void *loopback)
   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 */
@@ -1076,7 +1075,7 @@ static void routing_parse_Srandom(void)
        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, "")) {