git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/1] commit-reach: use unsigned int for flags in paint_down_to_common()

From
Moumita <dhar61595@gmail.com>
Date
Feb 12, 2025, 19:28 UTC
Message-ID
<20250212192841.8321-2-dhar61595@gmail.com>
In-Reply-To
<20250212192841.8321-1-dhar61595@gmail.com>

The `flags` variable in `paint_down_to_common()` stores bitwise flags (PARENT1, PARENT2, and STALE), which are defined as `(1u << N)`. Since these are already unsigned values,`flags` can also be declared as `unsigned int` instead of `int`.

Signed-off-by: Moumita <dhar61595@gmail.com>
---
 commit-reach.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/commit-reach.c b/commit-reach.c
index a339e41aa4..a4aaae2737 100644
--- a/commit-reach.c
+++ b/commit-reach.c
@@ -79,7 +79,7 @@ static int paint_down_to_common(struct repository *r,
 	while (queue_has_nonstale(&queue)) {
 		struct commit *commit = prio_queue_get(&queue);
 		struct commit_list *parents;
-		int flags;
+		unsigned int flags;
 		timestamp_t generation = commit_graph_generation(commit);
 
 		if (min_generation && generation > last_gen)
-- 
2.48.0
Previous: MoumitaNext: Junio C Hamano
Message 2 of 3 in “[GSOC] Use unsigned type for bit flags in commit-reach.c”
  1. 0/1 [GSOC] Use unsigned type for bit flags in commit-reach.cMoumita, Feb 12, 2025
  2. 1/1 commit-reach: use unsigned int for flags in paint_down_to_common()Moumita, Feb 12, 2025
  3. Junio C HamanoFeb 12, 2025

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.