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

[Newcomer][PATCH] graph.c: change graph_line->width type to int to remove sign-compare warning

From
OCOctavio Carneiro <ocarneiro1@gmail.com>
Date
May 21, 2025, 19:13 UTC
Message-ID
<20250521191352.30849-1-ocarneiro1@gmail.com>
A comparison between graph_line->width (of type size_t) and git_graph->width (of type int) causes -Wsign-compare to complain.
Looking at the git_graph struct definition, its size variables are int-typed.
Therefore, I changed the type of graph_line->width to also be a int, thus removing the warning trigger.
Signed-off-by: Octavio Carneiro <ocarneiro1@gmail.com>
---
 graph.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/graph.c b/graph.c
index 26f6fbf000..cb2221700e 100644
--- a/graph.c
+++ b/graph.c
@@ -1,5 +1,3 @@
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
 #include "git-compat-util.h"
 #include "gettext.h"
 #include "config.h"
@@ -115,7 +113,7 @@ static const char *column_get_color_code(unsigned short color)
 
 struct graph_line {
 	struct strbuf *buf;
-	size_t width;
+	int width;
 };
 
 static inline void graph_line_addch(struct graph_line *line, int c)
-- 
2.34.1
Next: Junio C Hamano
Message 1 of 3 in “graph.c: change graph_line->width type to int to remove sign-compare warning”
  1. Octavio CarneiroMay 21, 2025
  2. Junio C HamanoMay 21, 2025
  3. O. C.May 23, 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.