XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing");
AS_t model_generic_create_sized(size_t childsize) {
- AS_t new_component = xbt_malloc0(childsize);
+ AS_t new_component = model_none_create_sized(childsize);
new_component->parse_PU = generic_parse_PU;
new_component->parse_AS = generic_parse_AS;
new_component->get_onelink_routes = NULL;
new_component->get_bypass_route =
generic_get_bypassroute;
- new_component->finalize = NULL;
+ new_component->finalize = model_none_finalize;
new_component->to_index = xbt_dict_new();
new_component->bypassRoutes = xbt_dict_new();
return NULL;
}
-static void none_finalize(AS_t rc)
-{
- xbt_free(rc);
+void model_none_finalize(AS_t as) {
+ xbt_free(as);
}
static void none_parse_PU(AS_t rc,
}
/* Creation routing model functions */
-AS_t model_none_create(void)
-{
- AS_t new_component = xbt_new(s_as_t, 1);
+AS_t model_none_create() {
+ return model_none_create_sized(sizeof(s_as_t));
+}
+AS_t model_none_create_sized(size_t childsize) {
+ AS_t new_component = xbt_malloc0(childsize);
new_component->parse_PU = none_parse_PU;
new_component->parse_AS = none_parse_AS;
new_component->parse_route = NULL;
new_component->get_route = none_get_route;
new_component->get_onelink_routes = none_get_onelink_routes;
new_component->get_bypass_route = none_get_bypass_route;
- new_component->finalize = none_finalize;
+ new_component->finalize = model_none_finalize;
return new_component;
}
/* ******************************* NO ROUTING ******************************* */
/* Only save the AS tree, and forward calls to child ASes */
AS_t model_none_create(void);
-
+AS_t model_none_create_sized(size_t childsize);
+void model_none_finalize(AS_t as);
/* ************************************************************************** */
/* ***************** GENERIC PARSE FUNCTIONS (declarations) ***************** */
AS_t model_generic_create_sized(size_t childsize);