]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Refactor deaggregate()
authorIgor Putovny <igor.putovny@nic.cz>
Tue, 18 Feb 2025 15:41:12 +0000 (16:41 +0100)
committerIgor Putovny <igor.putovny@nic.cz>
Tue, 18 Feb 2025 15:41:12 +0000 (16:41 +0100)
proto/aggregator/aggregator.c

index 56c4c7b7bdc60511b6da27033672badf676f1580..18ebd3b55aecef629480a8b0e59afad59567e683 100644 (file)
@@ -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]);