0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-23 10:11:53 +00:00

Change order of parameters in a few functions

This commit is contained in:
Igor Putovny 2023-10-18 12:06:27 +02:00
parent dca392e7c6
commit 4352095801

View File

@ -191,9 +191,9 @@ get_ancestor_bucket(const struct trie_node *node)
static void static void
first_pass(struct trie_node *node, slab *trie_slab) first_pass(struct trie_node *node, slab *trie_slab)
{ {
bug("first pass");
assert(node != NULL); assert(node != NULL);
assert(trie_slab != NULL); assert(trie_slab != NULL);
//assert(node->bucket != NULL);
if (is_leaf(node)) if (is_leaf(node))
{ {
@ -209,6 +209,7 @@ first_pass(struct trie_node *node, slab *trie_slab)
{ {
struct trie_node *new = new_node(trie_slab); struct trie_node *new = new_node(trie_slab);
new->parent = node; new->parent = node;
new->bucket = get_ancestor_bucket(new);
node->child[i] = new; node->child[i] = new;
} }
} }
@ -255,7 +256,7 @@ aggregator_bucket_compare(const void *a, const void *b)
* Compute intersection of two sets of potential buckets in @left and @right and put result in @node * Compute intersection of two sets of potential buckets in @left and @right and put result in @node
*/ */
static void static void
aggregator_bucket_intersect(struct trie_node *node, const struct trie_node *left, const struct trie_node *right) aggregator_bucket_intersect(const struct trie_node *left, const struct trie_node *right, struct trie_node *node)
{ {
assert(node != NULL); assert(node != NULL);
assert(left != NULL); assert(left != NULL);
@ -288,7 +289,7 @@ aggregator_bucket_intersect(struct trie_node *node, const struct trie_node *left
* Compute union of two sets of potential buckets in @left and @right and put result in @node * Compute union of two sets of potential buckets in @left and @right and put result in @node
*/ */
static void static void
aggregator_bucket_unionize(struct trie_node *node, const struct trie_node *left, const struct trie_node *right) aggregator_bucket_unionize(const struct trie_node *left, const struct trie_node *right, struct trie_node *node)
{ {
assert(node != NULL); assert(node != NULL);
assert(left != NULL); assert(left != NULL);
@ -420,13 +421,9 @@ second_pass(struct trie_node *node)
qsort(right->potential_buckets, right->potential_buckets_count, sizeof(struct aggregator_bucket *), aggregator_bucket_compare); qsort(right->potential_buckets, right->potential_buckets_count, sizeof(struct aggregator_bucket *), aggregator_bucket_compare);
if (bucket_sets_are_disjoint(left, right)) if (bucket_sets_are_disjoint(left, right))
aggregator_bucket_unionize(node, left, right); aggregator_bucket_unionize(left, right, node);
else else
aggregator_bucket_intersect(node, left, right); aggregator_bucket_intersect(left, right, node);
log("node: %p, potential buckets count: %d", node, node->potential_buckets_count);
assert(node->potential_buckets_count > 0);
} }
/* /*