git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 16:54 UTC

[PATCH v2] commit-reach: simplify cleanup of remaining bitmaps in ahead_behind()

From
René Scharfe <l.s.r@web.de>
Date
Mar 19, 2026, 16:24 UTC
Message-ID
<21adf042-2bd1-4022-8822-9ed4985122a4@web.de>
In-Reply-To
<06000e28-c1b1-472f-bd6b-367b6c8d208d@web.de>

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(-)
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);
 }
-- 
2.53.0
Previous: René ScharfeNext: Jeff King
Message 3 of 6 in “commit-reach: simplify cleanup of remaining bitmaps in ahead_behind()”
  1. commit-reach: simplify cleanup of remaining bitmaps in ahead_behind()René Scharfe, Mar 18, 2026
  2. René ScharfeMar 18, 2026
  3. commit-reach: simplify cleanup of remaining bitmaps in ahead_behind()René Scharfe, Mar 19, 2026
  4. Jeff KingMar 19, 2026
  5. Junio C HamanoMar 19, 2026
  6. Derrick StoleeMar 20, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.