]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Add more assertions
authorIgor Putovny <igor.putovny@nic.cz>
Tue, 9 Apr 2024 09:35:49 +0000 (11:35 +0200)
committerIgor Putovny <igor.putovny@nic.cz>
Thu, 30 May 2024 10:30:00 +0000 (12:30 +0200)
proto/aggregator/aggregator.c

index 47e05f026ca709463a9f1f02993c276371200c31..ac6f02cdcb7114abca2d0485de83516d08a6fb01 100644 (file)
@@ -297,12 +297,15 @@ first_pass(struct trie_node *node, slab *trie_slab)
 
   if (is_leaf(node))
   {
+    /*
     for (int i = 0; i < node->potential_buckets_count; i++)
     {
       if (node->potential_buckets[i] == node->bucket)
         return;
     }
+    */
 
+    assert(node->bucket != NULL);
     node->potential_buckets[node->potential_buckets_count++] = node->bucket;
     return;
   }
@@ -513,12 +516,14 @@ second_pass(struct trie_node *node)
   assert(node != NULL);
   assert(node->potential_buckets_count <= MAX_POTENTIAL_BUCKETS_COUNT);
 
-  if (node->parent == NULL)
-    assert(node->bucket != NULL);
+  //if (node->parent == NULL)
+    //assert(node->bucket != NULL);
 
   if (is_leaf(node))
   {
     assert(node->potential_buckets_count > 0);
+    assert(node->potential_buckets[0] != NULL);
+    assert(node->potential_buckets[0] == node->bucket);
     return;
   }
 
@@ -593,8 +598,8 @@ third_pass(struct trie_node *node)
   if (node == NULL)
     return;
 
-  if (node->parent == NULL)
-    assert(node->bucket != NULL);
+  //if (node->parent == NULL)
+    //assert(node->bucket != NULL);
 
   assert(node->potential_buckets_count <= MAX_POTENTIAL_BUCKETS_COUNT);
 
@@ -602,7 +607,8 @@ third_pass(struct trie_node *node)
   if (node->parent == NULL)
   {
     assert(node->potential_buckets_count > 0);
-    assert(node->bucket != NULL);
+    assert(node->potential_buckets[0] != NULL);
+    //assert(node->bucket != NULL);
     node->bucket = node->potential_buckets[0];
     goto descent;
   }