X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/26f15ac9dcd0ab193a4072554a1c0487a0f80a69..035063bc298e061d8f47cc49f63311451d681af7:/src/surf/surf_routing.c diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index a0df3bb2de..78d9f4667e 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -55,7 +55,7 @@ static void routing_parse_Sconfig(void); /* config Tag */ static void routing_parse_Econfig(void); /* config Tag */ static char* replace_random_parameter(char * chaine); -static void clean_dict_random(void); +static void clean_routing_after_parse(void); /* this lines are only for replace use like index in the model table */ typedef enum { @@ -833,6 +833,20 @@ static double get_latency(const char *src, const char *dst) return latency; } +static int surf_parse_models_setup_already_called=0; +/* Call the last initialization functions, that must be called after the + * tag, if any, and before the first of cluster|peer|AS|trace|trace_connect + */ +void surf_parse_models_setup() +{ + if (surf_parse_models_setup_already_called) + return; + surf_parse_models_setup_already_called=1; + routing_parse_Erandom(); + surf_config_models_setup(); +} + + /** * \brief Recursive function for finalize * @@ -874,6 +888,8 @@ static void finalize(void) xbt_dynar_free(&(global_routing->last_route)); /* delete global routing structure */ xbt_free(global_routing); + /* make sure that we will reinit the models while loading the platf once reinited -- HACK but there is no proper surf_routing_init() */ + surf_parse_models_setup_already_called = 0; } static xbt_dynar_t recursive_get_onelink_routes(routing_component_t rc) @@ -980,7 +996,7 @@ void routing_model_create(size_t size_of_links, void *loopback, double_f_cpvoid_ &routing_parse_Speer); surfxml_add_callback(ETag_surfxml_platform_cb_list, - &clean_dict_random); + &clean_routing_after_parse); #ifdef HAVE_TRACING instr_routing_define_callbacks(); @@ -995,19 +1011,6 @@ void surf_parse_add_callback_config(void) surfxml_add_callback(STag_surfxml_random_cb_list, &routing_parse_Srandom); } -/* Call the last initialization functions, that must be called after the - * tag, if any, and before the first of cluster|peer|AS|trace|trace_connect - */ -void surf_parse_models_setup() -{ - static int already_called=0; - if (already_called) - return; - already_called=1; - routing_parse_Erandom(); - surf_config_models_setup(); -} - /* ************************************************** */ /* ********** PATERN FOR NEW ROUTING **************** */ @@ -1866,7 +1869,7 @@ static char* replace_random_parameter(char * string) return string; } -static void clean_dict_random(void) +static void clean_routing_after_parse(void) { xbt_dict_free(&random_value); xbt_dict_free(&patterns);