0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-10 05:08:42 +00:00

Fix const warning, add few comments

This commit is contained in:
Igor Putovny 2023-09-20 13:28:42 +02:00
parent f7161a875f
commit 9954b24f57

View File

@ -133,7 +133,7 @@ delete_trie(struct trie_node *node)
* Insert prefix in @addr to prefix trie with root at @node * Insert prefix in @addr to prefix trie with root at @node
*/ */
static void static void
trie_insert_prefix(const union net_addr_union *addr, const struct aggregator_bucket *bucket, struct trie_node * const root, slab *trie_slab) trie_insert_prefix(const union net_addr_union *addr, struct aggregator_bucket *bucket, struct trie_node * const root, slab *trie_slab)
{ {
assert(addr != NULL); assert(addr != NULL);
assert(bucket != NULL); assert(bucket != NULL);
@ -194,6 +194,7 @@ first_pass(struct trie_node *node, slab *trie_slab)
return; return;
} }
/* Add leaves so that each node has either two or no children */
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
if (!node->child[i]) if (!node->child[i])
@ -212,6 +213,9 @@ first_pass(struct trie_node *node, slab *trie_slab)
node->bucket = NULL; node->bucket = NULL;
} }
/*
* Compare two bucket pointers
*/
static int static int
aggregator_bucket_compare(const void *a, const void *b) aggregator_bucket_compare(const void *a, const void *b)
{ {
@ -412,7 +416,7 @@ second_pass(struct trie_node *node)
* Check if @bucket is one of potential nexthop buckets in @node * Check if @bucket is one of potential nexthop buckets in @node
*/ */
static int static int
bucket_is_present(const struct aggregator_bucket *bucket, const struct trie_node *node) is_bucket_potential(const struct aggregator_bucket *bucket, const struct trie_node *node)
{ {
for (int i = 0; i < node->potential_buckets_count; i++) for (int i = 0; i < node->potential_buckets_count; i++)
if (node->potential_buckets[i] == bucket) if (node->potential_buckets[i] == bucket)