routing_global_t global_routing = NULL;
routing_component_t current_routing = NULL;
model_type_t current_routing_model = NULL;
-static double_f_pvoid_t get_link_latency = NULL;
+static double_f_cpvoid_t get_link_latency = NULL;
/* Prototypes of each model */
static void *model_full_create(void); /* create structures for full routing model */
}
/**
- * \breif Set the endpoints for a route from XML
+ * \brief Set the endpoints for a route from XML
*/
static void parse_S_route_new_and_endpoints_XML(void)
{
}
/**
- * \breif Set the endpoints for a route from lua
+ * \brief Set the endpoints for a route from lua
*/
static void parse_S_route_new_and_endpoints_lua(const char *id_src, const char *id_dst)
{
}
/* (3) find the common father */
- index_src = (path_src->used) - 1;
- index_dst = (path_dst->used) - 1;
+ index_src = path_src->used - 1;
+ index_dst = path_dst->used - 1;
current_src = xbt_dynar_get_ptr(path_src, index_src);
current_dst = xbt_dynar_get_ptr(path_dst, index_dst);
while (index_src >= 0 && index_dst >= 0 && *current_src == *current_dst) {
static double _get_latency(const char *src, const char *dst)
{
- void *link;
- unsigned int cpt = 0;
double latency, latency_src, latency_dst = 0.0;
DEBUG2("Solve route \"%s\" to \"%s\"", src, dst);
xbt_assert0(src && dst, "bad parameters for \"_get_route\" method");
- route_extended_t e_route, e_route_cnt, e_route_src = NULL, e_route_dst =
- NULL;
+ route_extended_t e_route, e_route_cnt;
xbt_dynar_t elem_father_list = elements_father(src, dst);
*
* Make a global routing structure and set all the parsing functions.
*/
-void routing_model_create(size_t size_of_links, void *loopback, double_f_pvoid_t get_link_latency_fun )
+void routing_model_create(size_t size_of_links, void *loopback, double_f_cpvoid_t get_link_latency_fun)
{
/* config the uniq global routing */
xbt_dynar_free(&(*elem)->re_str_link);
pcre_free((*elem)->re_src);
pcre_free((*elem)->re_dst);
- xbt_free((*elem));
+ xbt_free(*elem);
}
- (*elem) = NULL;
+ *elem = NULL;
}
static void rule_route_extended_free(void *e)
pcre_free((*elem)->generic_rule_route.re_dst);
xbt_free((*elem)->re_src_gateway);
xbt_free((*elem)->re_dst_gateway);
- xbt_free((*elem));
+ xbt_free(*elem);
}
}
xbt_dict_set(_to_index, name, id, xbt_free);
}
-static int surf_pointer_resource_cmp(const void *a, const void *b) {
- if(a == b)
- return 0;
- return 1;
+static int surf_pointer_resource_cmp(const void *a, const void *b)
+{
+ return a != b;
}
-static int surf_link_resource_cmp(const void *a, const void *b) {
- if( memcmp(a,b,global_routing->size_of_link) == 0 );
- return 0;
- return 1;
+static int surf_link_resource_cmp(const void *a, const void *b)
+{
+ return !!memcmp(a,b,global_routing->size_of_link);
}
static void generic_set_bypassroute(routing_component_t rc,
}
/* (3) find the common father */
- index_src = (path_src->used) - 1;
- index_dst = (path_dst->used) - 1;
+ index_src = path_src->used - 1;
+ index_dst = path_dst->used - 1;
current_src = xbt_dynar_get_ptr(path_src, index_src);
current_dst = xbt_dynar_get_ptr(path_dst, index_dst);
while (index_src >= 0 && index_dst >= 0 && *current_src == *current_dst) {
current_dst = xbt_dynar_get_ptr(path_dst, index_dst);
}
- int max_index_src = (path_src->used) - 1;
- int max_index_dst = (path_dst->used) - 1;
+ int max_index_src = path_src->used - 1;
+ int max_index_dst = path_dst->used - 1;
int max_index = max(max_index_src, max_index_dst);
int i, max;