From: Igor Putovny Date: Tue, 18 Feb 2025 15:41:12 +0000 (+0100) Subject: Refactor deaggregate() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c577103d5f36173213090c9d94b2c4a7c38bf7a;p=thirdparty%2Fbird.git Refactor deaggregate() --- diff --git a/proto/aggregator/aggregator.c b/proto/aggregator/aggregator.c index 56c4c7b7b..18ebd3b55 100644 --- a/proto/aggregator/aggregator.c +++ b/proto/aggregator/aggregator.c @@ -966,20 +966,16 @@ deaggregate(struct trie_node * const node) memset(node->potential_buckets, 0, sizeof(node->potential_buckets)); /* - * Original prefixes are IN_FIB and already have their original bucket - * set by trie_insert_prefix(). Otherwise they inherit it from their - * parents. + * Original prefixes already have their original bucket set, + * others inherit it from their parents. */ - if (ORIGINAL == node->px_origin) - { - assert(node->original_bucket != NULL); - } - else + if (ORIGINAL != node->px_origin) { + assert(node->original_bucket == NULL); node->original_bucket = node->parent->original_bucket; - assert(node->original_bucket != NULL); } + assert(node->original_bucket != NULL); assert(node->potential_buckets_count == 0); /* As in the first pass, leaves get one potential bucket */ @@ -990,10 +986,6 @@ deaggregate(struct trie_node * const node) node_add_potential_bucket(node, node->original_bucket); } - assert(node->original_bucket != NULL); - assert(node->selected_bucket == NULL); - assert(node->ancestor == NULL); - if (node->child[0]) deaggregate(node->child[0]);