public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>,  Patrick Steinhardt <ps@pks.im>,
	Derrick Stolee <stolee@gmail.com>
Subject: Re: [PATCH v2] commit-reach: simplify cleanup of remaining bitmaps in ahead_behind()
Date: Thu, 19 Mar 2026 10:44:52 -0700	[thread overview]
Message-ID: <xmqqjyv7lnmz.fsf@gitster.g> (raw)
In-Reply-To: <21adf042-2bd1-4022-8822-9ed4985122a4@web.de> ("René Scharfe"'s message of "Thu, 19 Mar 2026 17:24:40 +0100")

René Scharfe <l.s.r@web.de> 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 <l.s.r@web.de>
> ---
>  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);
>  }

  reply	other threads:[~2026-03-19 17:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18 12:45 [PATCH] commit-reach: simplify cleanup of remaining bitmaps in ahead_behind() René Scharfe
2026-03-18 16:09 ` René Scharfe
2026-03-19 16:57   ` Jeff King
2026-03-19 16:24 ` [PATCH v2] " René Scharfe
2026-03-19 17:44   ` Junio C Hamano [this message]
2026-03-20 16:35     ` Derrick Stolee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqjyv7lnmz.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    --cc=ps@pks.im \
    --cc=stolee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox