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

Fix aggregator_bucket_unionize()

The last two while loops were incorrectly placed inside the first while loop
This commit is contained in:
Igor Putovny 2023-09-21 12:37:37 +02:00
parent 9954b24f57
commit 26ac6dca5c

View File

@ -323,28 +323,28 @@ aggregator_bucket_unionize(struct trie_node *node, const struct trie_node *left,
default: default:
bug("Impossible"); bug("Impossible");
} }
}
while (i < left->potential_buckets_count) while (i < left->potential_buckets_count)
{ {
if (node->potential_buckets_count >= MAX_POTENTIAL_NEXTHOP_COUNT) if (node->potential_buckets_count >= MAX_POTENTIAL_NEXTHOP_COUNT)
return; return;
if (node->potential_buckets_count == 0 || node->potential_buckets[node->potential_buckets_count - 1] != 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]; node->potential_buckets[node->potential_buckets_count++] = left->potential_buckets[i];
i++; i++;
} }
while (j < right->potential_buckets_count) while (j < right->potential_buckets_count)
{ {
if (node->potential_buckets_count >= MAX_POTENTIAL_NEXTHOP_COUNT) if (node->potential_buckets_count >= MAX_POTENTIAL_NEXTHOP_COUNT)
return; return;
if (node->potential_buckets_count == 0 || node->potential_buckets[node->potential_buckets_count - 1] != 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]; node->potential_buckets[node->potential_buckets_count++] = right->potential_buckets[j];
j++; j++;
}
} }
} }