static void routing_parse_Econfig(void); /*config Tag */
static char* replace_random_parameter(char * chaine);
+static void clean_dict_random(void);
/* this lines are only for replace use like index in the model table */
typedef enum {
static char *gw_dst = NULL; /* temporary store the gateway destination name of a route */
static xbt_dynar_t link_list = NULL; /* temporary store of current list link of a route */
-static xbt_dict_t coordinates = NULL;
-
static double eculidean_dist_comp(int index, xbt_dynar_t src, xbt_dynar_t dst)
{
{
double euclidean_dist;
xbt_dynar_t src_ctn, dst_ctn;
- src_ctn = xbt_dict_get(coordinates, src);
- dst_ctn = xbt_dict_get(coordinates, dst);
+ src_ctn = xbt_lib_get_or_null(host_lib, src, COORD_HOST_LEVEL);
+ if(!src_ctn) src_ctn = xbt_lib_get_or_null(as_router_lib, src, COORD_ASR_LEVEL);
+ dst_ctn = xbt_lib_get_or_null(host_lib, dst, COORD_HOST_LEVEL);
+ if(!dst_ctn) dst_ctn = xbt_lib_get_or_null(as_router_lib, dst, COORD_ASR_LEVEL);
+
+ if(dst_ctn == NULL || src_ctn == NULL)
+ xbt_die("Coord src '%s' :%p dst '%s' :%p",src,src_ctn,dst,dst_ctn);
euclidean_dist = sqrt (eculidean_dist_comp(0,src_ctn,dst_ctn)+eculidean_dist_comp(1,src_ctn,dst_ctn))
+fabs(atof(xbt_dynar_get_as(src_ctn, 2, char *)))+fabs(atof(xbt_dynar_get_as(dst_ctn, 2, char *)));
if (strcmp(coord,"")) {
xbt_dynar_t ctn = xbt_str_split_str(coord, " ");
xbt_dynar_shrink(ctn,0);
- xbt_dict_set (coordinates,host_id,ctn,NULL);
+ xbt_lib_set(host_lib, host_id, COORD_HOST_LEVEL, ctn);
}
*/
}
/**
* \brief Add a "host" to the network element list
*/
-void parse_S_host(const char *host_id, const char* coord)
+static void parse_S_host(const char *host_id, const char* coord)
{
network_element_info_t info = NULL;
if (current_routing->hierarchy == SURF_ROUTING_NULL)
current_routing->hierarchy = SURF_ROUTING_BASE;
- xbt_assert1(!xbt_dict_get_or_null
- (global_routing->where_network_elements, host_id),
+ xbt_assert1(!xbt_lib_get_or_null(host_lib, host_id,ROUTING_HOST_LEVEL),
"Reading a host, processing unit \"%s\" already exists",
host_id);
xbt_assert1(current_routing->set_processing_unit,
info = xbt_new0(s_network_element_info_t, 1);
info->rc_component = current_routing;
info->rc_type = SURF_NETWORK_ELEMENT_HOST;
- xbt_dict_set(global_routing->where_network_elements, host_id,
- (void *) info, xbt_free);
+ xbt_lib_set(host_lib,host_id,ROUTING_HOST_LEVEL,(void *) info);
if (strcmp(coord,"")) {
xbt_dynar_t ctn = xbt_str_split_str(coord, " ");
xbt_dynar_shrink(ctn, 0);
- xbt_dict_set(coordinates, host_id, ctn, xbt_dynar_free_voidp);
+ xbt_lib_set(host_lib,host_id,COORD_HOST_LEVEL,(void *) ctn);
}
}
/**
* \brief Add a "router" to the network element list
*/
-static void parse_S_router(void)
+static void parse_S_router(const char *router_id)
{
network_element_info_t info = NULL;
if (current_routing->hierarchy == SURF_ROUTING_NULL)
current_routing->hierarchy = SURF_ROUTING_BASE;
- xbt_assert1(!xbt_dict_get_or_null
- (global_routing->where_network_elements,
- A_surfxml_router_id),
+ xbt_assert1(!xbt_lib_get_or_null(as_router_lib,A_surfxml_router_id, ROUTING_ASR_LEVEL),
"Reading a router, processing unit \"%s\" already exists",
- A_surfxml_router_id);
+ router_id);
xbt_assert1(current_routing->set_processing_unit,
"no defined method \"set_processing_unit\" in \"%s\"",
current_routing->name);
(*(current_routing->set_processing_unit)) (current_routing,
- A_surfxml_router_id);
+ router_id);
info = xbt_new0(s_network_element_info_t, 1);
info->rc_component = current_routing;
info->rc_type = SURF_NETWORK_ELEMENT_ROUTER;
- xbt_dict_set(global_routing->where_network_elements, A_surfxml_router_id,
- (void *) info, xbt_free);
+
+ xbt_lib_set(as_router_lib,router_id,ROUTING_ASR_LEVEL,(void *) info);
if (strcmp(A_surfxml_router_coordinates,"")) {
- xbt_dynar_t ctn = xbt_str_split_str(A_surfxml_router_coordinates, " ");
- xbt_dynar_shrink(ctn, 0);
- xbt_dict_set(coordinates, A_surfxml_router_id, ctn, xbt_dynar_free_voidp);
+ xbt_dynar_t ctn = xbt_str_split_str(A_surfxml_router_coordinates, " ");
+ xbt_dynar_shrink(ctn, 0);
+ xbt_lib_set(as_router_lib,router_id,COORD_ASR_LEVEL,(void *) ctn);
}
}
+/**
+ * brief Add a "router" to the network element list from XML description
+ */
+static void parse_S_router_XML(void)
+{
+ return parse_S_router(A_surfxml_router_id);
+}
+
+/**
+ * brief Add a "router" to the network element list from XML description
+ */
+static void parse_S_router_lua(const char* router_id)
+{
+ return parse_S_router(router_id);
+}
+
/**
* \brief Set the endponints for a route
*/
-void parse_S_route_new_and_endpoints(const char *src_id, const char *dst_id)
+static void parse_S_route_new_and_endpoints(const char *src_id, const char *dst_id)
{
if (src != NULL && dst != NULL && link_list != NULL)
THROW2(arg_error, 0, "Route between %s to %s can not be defined",
/**
* \brief Set a new link on the actual list of link for a route or ASroute
*/
-void parse_E_link_ctn_new_elem(const char *link_id)
+static void parse_E_link_ctn_new_elem(const char *link_id)
{
char *val;
val = xbt_strdup(link_id);
/**
* \brief Store the route by calling the set_route function of the current routing component
*/
-void parse_E_route_store_route(void)
+static void parse_E_route_store_route(void)
{
name_route_extended_t route = xbt_new0(s_name_route_extended_t, 1);
route->generic_route.link_list = link_list;
* make the new structure and
* set the parsing functions to allows parsing the part of the routing tree
*/
-void parse_S_AS(char *AS_id, char *AS_routing)
+static void parse_S_AS(char *AS_id, char *AS_routing)
{
routing_component_t new_routing;
model_type_t model = NULL;
XBT_DEBUG("%s coordinates : %s", A_surfxml_AS_id, A_surfxml_AS_coordinates);
xbt_dynar_t ctn = xbt_str_split_str(A_surfxml_AS_coordinates, " ");
xbt_dynar_shrink(ctn, 0);
- xbt_dict_set(coordinates, A_surfxml_AS_id, ctn, xbt_dynar_free_voidp);
+ xbt_lib_set(as_router_lib,A_surfxml_AS_id,COORD_ASR_LEVEL,(void *) ctn);
}
}
* When you finish to read the routing component, other structures must be created.
* the "end" method allow to do that for any routing model type
*/
-void parse_E_AS(const char *AS_id)
+static void parse_E_AS(const char *AS_id)
{
if (current_routing == NULL) {
THROW1(arg_error, 0, "Close AS(%s), that never open", AS_id);
} else {
network_element_info_t info = NULL;
- xbt_assert1(!xbt_dict_get_or_null
- (global_routing->where_network_elements,
- current_routing->name), "The AS \"%s\" already exists",
- current_routing->name);
+ xbt_assert1(!xbt_lib_get_or_null(as_router_lib,current_routing->name, ROUTING_ASR_LEVEL),
+ "The AS \"%s\" already exists",current_routing->name);
info = xbt_new0(s_network_element_info_t, 1);
info->rc_component = current_routing->routing_father;
info->rc_type = SURF_NETWORK_ELEMENT_AS;
- xbt_dict_set(global_routing->where_network_elements,
- current_routing->name, info, xbt_free);
+ xbt_lib_set(as_router_lib,current_routing->name,ROUTING_ASR_LEVEL,(void *) info);
+
(*(current_routing->routing->unload)) ();
(*(current_routing->routing->end)) ();
current_routing = current_routing->routing_father;
/* (1) find the as where the host is located */
as_comp = ((network_element_info_t)
- xbt_dict_get_or_null(global_routing->where_network_elements,
- name))->rc_component;
+ xbt_lib_get_or_null(host_lib,name, ROUTING_HOST_LEVEL))->rc_component;
return as_comp->name;
}
routing_component_t *father = NULL;
/* (1) find the as where the src and dst are located */
- src_as = ((network_element_info_t)
- xbt_dict_get_or_null(global_routing->where_network_elements,
- src))->rc_component;
- dst_as = ((network_element_info_t)
- xbt_dict_get_or_null(global_routing->where_network_elements,
- dst))->rc_component;
+ void * src_data = xbt_lib_get_or_null(host_lib,src, ROUTING_HOST_LEVEL);
+ void * dst_data = xbt_lib_get_or_null(host_lib,dst, ROUTING_HOST_LEVEL);
+ if(!src_data) src_data = xbt_lib_get_or_null(as_router_lib,src, ROUTING_ASR_LEVEL);
+ if(!dst_data) dst_data = xbt_lib_get_or_null(as_router_lib,dst, ROUTING_ASR_LEVEL);
+ src_as = ((network_element_info_t)src_data)->rc_component;
+ dst_as = ((network_element_info_t)dst_data)->rc_component;
+
xbt_assert2(src_as
&& dst_as,
"Ask for route \"from\"(%s) or \"to\"(%s) no found", src,
{
/* delete recursibly all the tree */
_finalize(global_routing->root);
- /* delete "where" dict */
- xbt_dict_free(&(global_routing->where_network_elements));
- xbt_dict_free(&(coordinates));
/* delete last_route */
xbt_dynar_free(&(global_routing->last_route));
/* delete global routing structure */
return recursive_get_onelink_routes(global_routing->root);
}
-static e_surf_network_element_type_t get_network_element_type(const char
+e_surf_network_element_type_t get_network_element_type(const char
*name)
{
network_element_info_t rc = NULL;
- rc = xbt_dict_get(global_routing->where_network_elements, name);
- return rc->rc_type;
+
+ rc = xbt_lib_get_or_null(host_lib, name, ROUTING_HOST_LEVEL);
+ if(rc) return rc->rc_type;
+
+ rc = xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL);
+ if(rc) return rc->rc_type;
+
+ return SURF_NETWORK_ELEMENT_NULL;
}
/**
{
/* config the uniq global routing */
global_routing = xbt_new0(s_routing_global_t, 1);
- global_routing->where_network_elements = xbt_dict_new();
global_routing->root = NULL;
global_routing->get_route = get_route;
global_routing->get_latency = get_latency;
/* no current routing at moment */
current_routing = NULL;
- coordinates = xbt_dict_new();
-
/* parse generic elements */
surfxml_add_callback(STag_surfxml_host_cb_list, &parse_S_host_XML);
surfxml_add_callback(ETag_surfxml_host_cb_list, &parse_E_host_XML);
- surfxml_add_callback(STag_surfxml_router_cb_list, &parse_S_router);
+ surfxml_add_callback(STag_surfxml_router_cb_list, &parse_S_router_XML);
surfxml_add_callback(STag_surfxml_route_cb_list,
&parse_S_route_new_and_endpoints_XML);
surfxml_add_callback(STag_surfxml_peer_cb_list,
&routing_parse_Speer);
+ surfxml_add_callback(ETag_surfxml_platform_cb_list,
+ &clean_dict_random);
#ifdef HAVE_TRACING
instr_routing_define_callbacks();
xbt_dynar_t link_route_to_test = xbt_dynar_new(global_routing->size_of_link, NULL);
xbt_dynar_foreach(route->generic_route.link_list,i,link_name)
{
- void *link = xbt_dict_get_or_null(surf_network_model->resource_set, link_name);
+ void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
xbt_assert1(link,"Link : '%s' doesn't exists.",link_name);
xbt_dynar_push(link_route_to_test,&link);
}
(void*)link_route_to_test,
(int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp),
"The route between \"%s\" and \"%s\" already exists. If you are trying to define a reverse route, you must set the symmetrical=no attribute to your routes tags.", src,dst);
- xbt_dynar_free(&link_route_to_test);
}
else
{
if(!route->dst_gateway && !route->src_gateway)
XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
- else
+ else{
XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
route->src_gateway, dst, route->dst_gateway);
+ if(global_routing->get_network_element_type((const char*)route->dst_gateway) == SURF_NETWORK_ELEMENT_NULL)
+ xbt_die("The dst_gateway '%s' does not exist!",route->dst_gateway);
+ if(global_routing->get_network_element_type((const char*)route->src_gateway) == SURF_NETWORK_ELEMENT_NULL)
+ xbt_die("The src_gateway '%s' does not exist!",route->src_gateway);
+ }
TO_ROUTE_FULL(*src_id, *dst_id) = generic_new_extended_route(rc->hierarchy,route,1);
xbt_dynar_shrink(TO_ROUTE_FULL(*src_id, *dst_id)->generic_route.link_list, 0);
}
for(i=xbt_dynar_length(route->generic_route.link_list) ;i>0 ;i--)
{
link_name = xbt_dynar_get_as(route->generic_route.link_list,i-1,void *);
- void *link = xbt_dict_get_or_null(surf_network_model->resource_set, link_name);
+ void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
xbt_assert1(link,"Link : '%s' doesn't exists.",link_name);
xbt_dynar_push(link_route_to_test,&link);
}
(void*)link_route_to_test,
(int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp),
"The route between \"%s\" and \"%s\" already exists", src,dst);
- xbt_dynar_free(&link_route_to_test);
}
else
{
xbt_dynar_t link_route_to_test = xbt_dynar_new(global_routing->size_of_link, NULL);
xbt_dynar_foreach(route->generic_route.link_list,cpt,link_name)
{
- void *link = xbt_dict_get_or_null(surf_network_model->resource_set, link_name);
+ void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
xbt_assert1(link,"Link : '%s' doesn't exists.",link_name);
xbt_dynar_push(link_route_to_test,&link);
}
(void*)link_route_to_test,
(int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp),
"The route between \"%s\" and \"%s\" already exists", src,dst);
- xbt_free(link_route_to_test);
}
else
{
if(!route->dst_gateway && !route->src_gateway)
XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
- else
- XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
+ else{
+ XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
route->src_gateway, dst, route->dst_gateway);
-
+ if(global_routing->get_network_element_type((const char*)route->dst_gateway) == SURF_NETWORK_ELEMENT_NULL)
+ xbt_die("The dst_gateway '%s' does not exist!",route->dst_gateway);
+ if(global_routing->get_network_element_type((const char*)route->src_gateway) == SURF_NETWORK_ELEMENT_NULL)
+ xbt_die("The src_gateway '%s' does not exist!",route->src_gateway);
+ }
TO_FLOYD_LINK(*src_id, *dst_id) =
generic_new_extended_route(rc->hierarchy, route, 1);
TO_FLOYD_PRED(*src_id, *dst_id) = *src_id;
for(i=xbt_dynar_length(route->generic_route.link_list) ;i>0 ;i--)
{
link_name = xbt_dynar_get_as(route->generic_route.link_list,i-1,void *);
- void *link = xbt_dict_get_or_null(surf_network_model->resource_set, link_name);
+ void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
xbt_assert1(link,"Link : '%s' doesn't exists.",link_name);
xbt_dynar_push(link_route_to_test,&link);
}
(void*)link_route_to_test,
(int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp),
"The route between \"%s\" and \"%s\" already exists", src,dst);
- xbt_free(link_route_to_test);
}
else
{
new_component->generic_routing.set_autonomous_system =
generic_set_autonomous_system;
new_component->generic_routing.set_route = model_dijkstra_both_set_route;
- new_component->generic_routing.set_ASroute = model_dijkstra_both_set_route; //TODO
+ new_component->generic_routing.set_ASroute = model_dijkstra_both_set_route;
new_component->generic_routing.set_bypassroute = generic_set_bypassroute;
new_component->generic_routing.get_route = dijkstra_get_route;
new_component->generic_routing.get_latency = generic_get_link_latency;
if(!route->dst_gateway && !route->src_gateway)
XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
- else
+ else{
XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
route->src_gateway, dst, route->dst_gateway);
+ if(global_routing->get_network_element_type((const char*)route->dst_gateway) == SURF_NETWORK_ELEMENT_NULL)
+ xbt_die("The dst_gateway '%s' does not exist!",route->dst_gateway);
+ if(global_routing->get_network_element_type((const char*)route->src_gateway) == SURF_NETWORK_ELEMENT_NULL)
+ xbt_die("The src_gateway '%s' does not exist!",route->src_gateway);
+ }
route_extended_t e_route =
generic_new_extended_route(current_routing->hierarchy, route, 1);
if (rc_dst >= 0) {
res = pcre_get_substring_list(src, ovector_src, rc_src, &list_src);
xbt_assert1(!res, "error solving substring list for src \"%s\"", src);
- res = pcre_get_substring_list(dst, ovector_dst, rc_dst, &list_dst)
+ res = pcre_get_substring_list(dst, ovector_dst, rc_dst, &list_dst);
xbt_assert1(!res, "error solving substring list for src \"%s\"", dst);
char *link_name;
xbt_dynar_foreach(ruleroute->re_str_link, cpt, link_name) {
char *new_link_name =
remplace(link_name, list_src, rc_src, list_dst, rc_dst);
void *link =
- xbt_dict_get_or_null(surf_network_model->resource_set,
- new_link_name);
+ xbt_lib_get_or_null(link_lib, new_link_name, SURF_LINK_LEVEL);
if (link)
xbt_dynar_push(links_list, &link);
else
/* (1) find the as where the src and dst are located */
src_as = ((network_element_info_t)
- xbt_dict_get_or_null(global_routing->where_network_elements,
- src))->rc_component;
+ xbt_lib_get_or_null(host_lib, src, ROUTING_HOST_LEVEL))->rc_component;
dst_as = ((network_element_info_t)
- xbt_dict_get_or_null(global_routing->where_network_elements,
- dst))->rc_component;
+ xbt_lib_get_or_null(host_lib, dst, ROUTING_HOST_LEVEL))->rc_component;
xbt_assert2(src_as
&& dst_as,
"Ask for route \"from\"(%s) or \"to\"(%s) no found", src,
xbt_dynar_foreach(links, cpt, link_name) {
void *link =
- xbt_dict_get_or_null(surf_network_model->resource_set, link_name);
+ xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
if (link) {
if (order)
xbt_dynar_push(links_id, &link);
xbt_dynar_foreach(links, cpt, link_name) {
void *link =
- xbt_dict_get_or_null(surf_network_model->resource_set, link_name);
+ xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
if (link) {
if (order)
xbt_dynar_push(links_id, &link);
xbt_dict_cursor_t cursor = NULL;
char *key;
element_as = ((network_element_info_t)
- xbt_dict_get_or_null
- (global_routing->where_network_elements,
- element))->rc_component;
+ xbt_lib_get_or_null(as_router_lib, element, ROUTING_ASR_LEVEL))->rc_component;
result = ((routing_component_t) - 1);
if (element_as != rc)
result = generic_as_exist(rc, element_as);
{
routing_component_t element_as;
element_as = ((network_element_info_t)
- xbt_dict_get_or_null
- (global_routing->where_network_elements,
- element))->rc_component;
+ xbt_lib_get_or_null(host_lib,
+ element, ROUTING_HOST_LEVEL))->rc_component;
if (element_as == rc)
return element_as;
return generic_as_exist(rc, element_as);
static void generic_src_dst_check(routing_component_t rc, const char *src,
const char *dst)
{
- #ifndef NDEBUG
- routing_component_t src_as = ((network_element_info_t)
- xbt_dict_get_or_null
- (global_routing->where_network_elements,
- src))->rc_component;
- routing_component_t dst_as = ((network_element_info_t)
- xbt_dict_get_or_null
- (global_routing->where_network_elements,
- dst))->rc_component;
-
- xbt_assert3(src_as != NULL && dst_as != NULL,
- "Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"",
- src, dst, rc->name);
- xbt_assert4(src_as == dst_as,
- "The src(%s in %s) and dst(%s in %s) are in differents AS",
+
+ void * src_data = xbt_lib_get_or_null(host_lib,src, ROUTING_HOST_LEVEL);
+ void * dst_data = xbt_lib_get_or_null(host_lib,dst, ROUTING_HOST_LEVEL);
+ if(!src_data) src_data = xbt_lib_get_or_null(as_router_lib,src, ROUTING_ASR_LEVEL);
+ if(!dst_data) dst_data = xbt_lib_get_or_null(as_router_lib,dst, ROUTING_ASR_LEVEL);
+
+ if(src_data == NULL || dst_data == NULL)
+ xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"",
+ src, dst, rc->name);
+
+ routing_component_t src_as = ((network_element_info_t)src_data)->rc_component;
+ routing_component_t dst_as = ((network_element_info_t)dst_data)->rc_component;
+
+ if(src_as != dst_as)
+ xbt_die("The src(%s in %s) and dst(%s in %s) are in differents AS",
src, src_as->name, dst, dst_as->name);
- xbt_assert2(rc == dst_as,
- "The routing component of src and dst is not the same as the network elements belong (%s==%s)",
- rc->name, dst_as->name);
-#endif
+ if(rc != dst_as)
+ xbt_die("The routing component of src and dst is not the same as the network elements belong (%s==%s)",
+ rc->name, dst_as->name);
}
static void routing_parse_Sconfig(void)
xbt_cfg_set_parse(_surf_cfg_set, cfg);
else
XBT_INFO("The custom configuration '%s' is already define by user!",key);
- }
+ free(cfg);
+ }
XBT_DEBUG("End configuration name = %s",A_surfxml_config_id);
}
SURFXML_BUFFER_SET(AS_id, cluster_id);
#ifdef HAVE_PCRE_LIB
SURFXML_BUFFER_SET(AS_routing, "RuleBased");
+ SURFXML_BUFFER_SET(AS_coordinates, "");
XBT_DEBUG("<AS id=\"%s\"\trouting=\"RuleBased\">", cluster_id);
#else
SURFXML_BUFFER_SET(AS_routing, "Full");
+ SURFXML_BUFFER_SET(AS_coordinates, "");
XBT_DEBUG("<AS id=\"%s\"\trouting=\"Full\">", cluster_id);
#endif
SURFXML_START_TAG(AS);
xbt_free(temp_cluster_bw);
xbt_free(temp_cluster_lat);
+ xbt_free(temp_cluster_power);
free(link_id);
free(host_id);
break;
XBT_DEBUG("<router id=\"%s\"/>", router_id);
SURFXML_BUFFER_SET(router_id, router_id);
+ SURFXML_BUFFER_SET(router_coordinates, "");
SURFXML_START_TAG(router);
SURFXML_END_TAG(router);
xbt_free(string);
string = test_string;
} //In other case take old value (without ${})
-
+ else
+ free(test_string);
return string;
}
+static void clean_dict_random(void)
+{
+ XBT_DEBUG("Clean dict for random");
+ xbt_dict_free(&random_value);
+ xbt_dict_free(&patterns);
+}
+
static void routing_parse_Speer(void)
{
static int AX_ptr = 0;
double mean, std, min, max, seed;
char *random_id = A_surfxml_random_id;
char *random_radical = A_surfxml_random_radical;
+ char *rd_name = NULL;
+ char *rd_value;
surf_parse_get_double(&mean,A_surfxml_random_mean);
surf_parse_get_double(&std,A_surfxml_random_std_deviation);
surf_parse_get_double(&min,A_surfxml_random_min);
if(!strcmp(random_radical,""))
{
res = random_generate(random);
- xbt_dict_set(random_value, random_id, bprintf("%f",res), free);
+ rd_value = bprintf("%f",res);
+ xbt_dict_set(random_value, random_id, rd_value, free);
}
else
{
for (i = start; i <= end; i++) {
xbt_assert1(!xbt_dict_get_or_null(random_value,random_id),"Custom Random '%s' already exists !",bprintf("%s%d",random_id,i));
res = random_generate(random);
- tmpbuf = bprintf("%s%d",random_id,i);
+ tmpbuf = bprintf("%s%d",random_id,i);
xbt_dict_set(random_value, tmpbuf, bprintf("%f",res), free);
- xbt_free(tmpbuf);
+ xbt_free(tmpbuf);
}
break;
default:
XBT_INFO("Malformed radical");
}
res = random_generate(random);
- xbt_dict_set(random_value, bprintf("%s_router",random_id), bprintf("%f",res), free);
+ rd_name = bprintf("%s_router",random_id);
+ rd_value = bprintf("%f",res);
+ xbt_dict_set(random_value, rd_name, rd_value, free);
xbt_dynar_free(&radical_ends);
}
+ free(rd_name);
xbt_dynar_free(&radical_elements);
}
}