From aec8688fbc698b1b1dc860efdfc4670de52b54d8 Mon Sep 17 00:00:00 2001 From: Igor Putovny Date: Thu, 21 Sep 2023 12:37:37 +0200 Subject: [PATCH] Fix aggregator_bucket_unionize() The last two while loops were incorrectly placed inside the first while loop --- proto/aggregator/aggregator.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/proto/aggregator/aggregator.c b/proto/aggregator/aggregator.c index 735877ef..2065f951 100644 --- a/proto/aggregator/aggregator.c +++ b/proto/aggregator/aggregator.c @@ -323,28 +323,28 @@ aggregator_bucket_unionize(struct trie_node *node, const struct trie_node *left, default: bug("Impossible"); } + } - while (i < left->potential_buckets_count) - { - if (node->potential_buckets_count >= MAX_POTENTIAL_NEXTHOP_COUNT) - return; + while (i < left->potential_buckets_count) + { + if (node->potential_buckets_count >= MAX_POTENTIAL_NEXTHOP_COUNT) + return; - if (node->potential_buckets_count == 0 || node->potential_buckets[node->potential_buckets_count - 1] != left->potential_buckets[i]) - node->potential_buckets[node->potential_buckets_count++] = left->potential_buckets[i]; + if (node->potential_buckets_count == 0 || node->potential_buckets[node->potential_buckets_count - 1] != left->potential_buckets[i]) + node->potential_buckets[node->potential_buckets_count++] = left->potential_buckets[i]; - i++; - } + i++; + } - while (j < right->potential_buckets_count) - { - if (node->potential_buckets_count >= MAX_POTENTIAL_NEXTHOP_COUNT) - return; + while (j < right->potential_buckets_count) + { + if (node->potential_buckets_count >= MAX_POTENTIAL_NEXTHOP_COUNT) + return; - if (node->potential_buckets_count == 0 || node->potential_buckets[node->potential_buckets_count - 1] != right->potential_buckets[j]) - node->potential_buckets[node->potential_buckets_count++] = right->potential_buckets[j]; + if (node->potential_buckets_count == 0 || node->potential_buckets[node->potential_buckets_count - 1] != right->potential_buckets[j]) + node->potential_buckets[node->potential_buckets_count++] = right->potential_buckets[j]; - j++; - } + j++; } }