From: Igor Putovny Date: Tue, 18 Feb 2025 14:22:47 +0000 (+0100) Subject: Refactor X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=809cddfff1ebc3d8ce7b35877e8568552d293202;p=thirdparty%2Fbird.git Refactor --- diff --git a/proto/aggregator/aggregator.c b/proto/aggregator/aggregator.c index f8ef81456..83a0278f0 100644 --- a/proto/aggregator/aggregator.c +++ b/proto/aggregator/aggregator.c @@ -321,9 +321,9 @@ aggregator_prepare_rte_withdrawal(struct aggregator_proto *p, ip_addr prefix, u3 struct net_addr addr = { 0 }; net_fill_ipa(&addr, prefix, pxlen); - struct rte_withdrawal *node = lp_allocz(p->rte_withdrawal_pool, sizeof(*node)); + struct rte_withdrawal_item *node = lp_allocz(p->rte_withdrawal_pool, sizeof(*node)); - *node = (struct rte_withdrawal) { + *node = (struct rte_withdrawal_item) { .next = p->rte_withdrawal_stack, .bucket = bucket, }; @@ -347,14 +347,12 @@ aggregator_withdraw_rte(struct aggregator_proto *p) log(L_WARN "This number of updates was not expected." "They will be processed, but please, contact the developers."); - struct rte_withdrawal *node = p->rte_withdrawal_stack; + struct rte_withdrawal_item *node = NULL; - while (node) + while (node = p->rte_withdrawal_stack) { - assert(node != NULL); rte_update2(p->dst, &node->addr, NULL, node->bucket->last_src); - node = node->next; - p->rte_withdrawal_stack = node; + p->rte_withdrawal_stack = node->next; p->rte_withdrawal_count--; } diff --git a/proto/aggregator/aggregator.h b/proto/aggregator/aggregator.h index 69a0eb1bd..c22decde2 100644 --- a/proto/aggregator/aggregator.h +++ b/proto/aggregator/aggregator.h @@ -55,8 +55,9 @@ struct aggregator_bucket { struct f_val aggr_data[0]; }; -struct rte_withdrawal { - struct rte_withdrawal *next; +/* Structure containing information needed for route withdrawal */ +struct rte_withdrawal_item { + struct rte_withdrawal_item *next; struct aggregator_bucket *bucket; struct net_addr addr; }; @@ -97,7 +98,7 @@ struct aggregator_proto { struct hmap bucket_id_map; linpool *rte_withdrawal_pool; - struct rte_withdrawal *rte_withdrawal_stack; + struct rte_withdrawal_item *rte_withdrawal_stack; int rte_withdrawal_count; };