]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Refactor
authorIgor Putovny <igor.putovny@nic.cz>
Tue, 18 Feb 2025 14:22:47 +0000 (15:22 +0100)
committerIgor Putovny <igor.putovny@nic.cz>
Tue, 18 Feb 2025 14:23:04 +0000 (15:23 +0100)
proto/aggregator/aggregator.c
proto/aggregator/aggregator.h

index f8ef81456ffdd13ed808a24dd72b79cf757345d6..83a0278f0e898fe47dbc0b71b412f20ab51bf1cf 100644 (file)
@@ -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--;
   }
 
index 69a0eb1bde5f3cebf3c0b20224d813ffd8fd84d4..c22decde21ab8c05890b2fa17083a605ebe4fb97 100644 (file)
@@ -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;
 };