From e93a91fdbfece38a7de51e9da40c6388cdd0d6c8 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 8 Nov 2011 22:19:42 +0100 Subject: [PATCH] sanitize the way parsing callbacks of the routing submodule are registered --- include/surf/surfxml_parse.h | 1 - src/surf/surf_private.h | 1 + src/surf/surf_routing.c | 11 ++++------- src/surf/surfxml_parseplatf.c | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/include/surf/surfxml_parse.h b/include/surf/surfxml_parse.h index 6c01e2f9fc..de188574da 100644 --- a/include/surf/surfxml_parse.h +++ b/include/surf/surfxml_parse.h @@ -50,7 +50,6 @@ XBT_PUBLIC(void) surf_parse_free_callbacks(void); XBT_PUBLIC(void) surf_parse_error(char *msg); XBT_PUBLIC(double) surf_parse_get_double(const char *string); XBT_PUBLIC(int) surf_parse_get_int(const char *string); -XBT_PUBLIC(void) surf_parse_add_callback_config(void); XBT_PUBLIC(void) surf_parse_models_setup(void); /* Prototypes of the functions offered by flex */ XBT_PUBLIC(int) surf_parse_lex(void); diff --git a/src/surf/surf_private.h b/src/surf/surf_private.h index ad8bde924f..2534167163 100644 --- a/src/surf/surf_private.h +++ b/src/surf/surf_private.h @@ -197,6 +197,7 @@ struct s_routing_global { }; XBT_PUBLIC(void) routing_model_create(size_t size_of_link, void *loopback, double_f_cpvoid_t get_link_latency_fun); +XBT_PUBLIC(void) routing_register_callbacks(void); XBT_PUBLIC(void) routing_parse_Scluster(void); /* cluster bypass */ diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 987196f8b9..eaf46a2057 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -835,11 +835,14 @@ void routing_model_create(size_t size_of_links, void *loopback, double_f_cpvoid_ get_link_latency = get_link_latency_fun; /* no current routing at moment */ current_routing = NULL; +} - /* parse generic elements */ +void routing_register_callbacks() { sg_platf_host_add_cb(parse_S_host); sg_platf_router_add_cb(parse_S_router); + surfxml_add_callback(STag_surfxml_random_cb_list, &routing_parse_Srandom); + surfxml_add_callback(STag_surfxml_route_cb_list, &parse_S_route_new_and_endpoints_XML); surfxml_add_callback(STag_surfxml_ASroute_cb_list, @@ -867,12 +870,6 @@ void routing_model_create(size_t size_of_links, void *loopback, double_f_cpvoid_ #endif } -void surf_parse_add_callback_config(void) -{ - surfxml_add_callback(STag_surfxml_random_cb_list, &routing_parse_Srandom); -} - - /* ************************************************** */ /* ********** PATERN FOR NEW ROUTING **************** */ diff --git a/src/surf/surfxml_parseplatf.c b/src/surf/surfxml_parseplatf.c index 50e6301157..45db0f379a 100644 --- a/src/surf/surfxml_parseplatf.c +++ b/src/surf/surfxml_parseplatf.c @@ -181,7 +181,7 @@ void parse_platform_file(const char *file) /* Register classical callbacks */ surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties_XML); - surf_parse_add_callback_config(); + routing_register_callbacks(); surfxml_buffer_stack_stack_ptr = 1; surfxml_buffer_stack_stack[0] = 0; -- 2.20.1