]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Increase readability of old code
authorIgor Putovny <igor.putovny@nic.cz>
Wed, 15 Jan 2025 16:08:53 +0000 (17:08 +0100)
committerIgor Putovny <igor.putovny@nic.cz>
Wed, 15 Jan 2025 16:08:53 +0000 (17:08 +0100)
proto/aggregator/aggregator.c

index 9d085e80c2f3873ab7b5a6fe004844c517db02a5..a8f9340dc61a3af577e39dc56f7a78ff3ea3e28d 100644 (file)
@@ -2038,7 +2038,6 @@ static void
 trie_init(struct aggregator_proto *p)
 {
   p->root = create_new_node(p->trie_pool);
-  p->root->depth = 0;
 
   struct network *default_net = NULL;
 
@@ -2069,7 +2068,7 @@ trie_init(struct aggregator_proto *p)
   mem_hash_init(&haux);
   new_bucket->hash = mem_hash_value(&haux);
 
-  /* Assign ID to root node */
+  /* Assign ID to the root node bucket */
   new_bucket->id = get_new_bucket_id(p);
   proto_insert_bucket(p, new_bucket);
   assert(get_bucket_ptr(p, new_bucket->id) == new_bucket);
@@ -2091,9 +2090,14 @@ trie_init(struct aggregator_proto *p)
   HASH_INSERT2(p->routes, AGGR_RTE, p->p.pool, arte);
   HASH_INSERT2(p->buckets, AGGR_BUCK, p->p.pool, new_bucket);
 
-  /* Assign default route to the root */
-  p->root->original_bucket = new_bucket;
-  p->root->status = IN_FIB;
+  /* Initialize root node with default route */
+  *p->root = (struct trie_node) {
+    .original_bucket = new_bucket,
+    .status = IN_FIB,
+    .px_origin = ORIGINAL,
+    .depth = 0,
+  };
+
   log("Root prefix %N with default bucket %p", p->root->original_bucket->rte->net->n.addr, p->root->original_bucket);
 }