commit-reach: simplify cleanup of remaining bitmaps in ahead_behind ()

Don't bother extracting the last few remaining prio_queue items in
order when we only want to free their associated bitmaps; just iterate
over the item array.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
René Scharfe 2026-03-19 17:24:40 +01:00 committed by Junio C Hamano
parent 7ff1e8dc1e
commit 60d8b5af9b
1 changed files with 2 additions and 4 deletions

View File

@ -1117,10 +1117,8 @@ void ahead_behind(struct repository *r,


/* STALE is used here, PARENT2 is used by insert_no_dup(). */ /* STALE is used here, PARENT2 is used by insert_no_dup(). */
repo_clear_commit_marks(r, PARENT2 | STALE); repo_clear_commit_marks(r, PARENT2 | STALE);
while (prio_queue_peek(&queue)) { for (size_t i = 0; i < queue.nr; i++)
struct commit *c = prio_queue_get(&queue); free_bit_array(queue.array[i].data);
free_bit_array(c);
}
clear_bit_arrays(&bit_arrays); clear_bit_arrays(&bit_arrays);
clear_prio_queue(&queue); clear_prio_queue(&queue);
} }