From: Junio C Hamano Date: Thu, 19 Mar 2026 17:44:52 GMT Subject: Re: [PATCH v2] commit-reach: simplify cleanup of remaining bitmaps in ahead_behind() Message-ID: In-Reply-To: <21adf042-2bd1-4022-8822-9ed4985122a4@web.de> René Scharfe writes: > 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 > --- > commit-reach.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) Quite obvious and straightforward. Will queue. Thanks. > > diff --git a/commit-reach.c b/commit-reach.c > index 9604bbdcce..d3a9b3ed6f 100644 > --- a/commit-reach.c > +++ b/commit-reach.c > @@ -1117,10 +1117,8 @@ void ahead_behind(struct repository *r, > > /* STALE is used here, PARENT2 is used by insert_no_dup(). */ > repo_clear_commit_marks(r, PARENT2 | STALE); > - while (prio_queue_peek(&queue)) { > - struct commit *c = prio_queue_get(&queue); > - free_bit_array(c); > - } > + for (size_t i = 0; i < queue.nr; i++) > + free_bit_array(queue.array[i].data); > clear_bit_arrays(&bit_arrays); > clear_prio_queue(&queue); > }