From 2fe18fadab902831233e19186e9fa25cfaba07a4 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 10 Nov 2011 16:54:43 +0100 Subject: [PATCH 1/1] various cleanups and clarifications --- src/surf/surf_routing.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index f7bd97df6e..c09690bd3c 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -677,22 +677,20 @@ static double get_latency(const char *src, const char *dst) * This fuction is call by "finalize". It allow to finalize the * AS or routing components. It delete all the structures. */ -static void _finalize(AS_t rc) +static void finalize_rec(AS_t as) { - if (rc) { + if (as) { xbt_dict_cursor_t cursor = NULL; char *key; AS_t elem; - xbt_dict_foreach(rc->routing_sons, cursor, key, elem) { - _finalize(elem); - } - xbt_dict_t tmp_sons = rc->routing_sons; - char *tmp_name = rc->name; + xbt_dict_foreach(as->routing_sons, cursor, key, elem) + finalize_rec(elem); + + xbt_dict_t tmp_sons = as->routing_sons; + char *tmp_name = as->name; xbt_dict_free(&tmp_sons); xbt_free(tmp_name); - xbt_assert(rc->finalize, "no defined method \"finalize\" in \"%s\"", - current_routing->name); - (*(rc->finalize)) (rc); + as->finalize(as); } } @@ -705,7 +703,7 @@ static void _finalize(AS_t rc) static void finalize(void) { /* delete recursively all the tree */ - _finalize(global_routing->root); + finalize_rec(global_routing->root); /* delete last_route */ xbt_dynar_free(&(global_routing->last_route)); /* delete global routing structure */ -- 2.20.1