git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Octavio Carneiro <ocarneiro1@gmail.com>
To: git@vger.kernel.org
Cc: ocarneiro1@gmail.com, ps@pks.im, gitster@pobox.com, newren@gmail.com
Subject: [Newcomer][PATCH] graph.c: change graph_line->width type to int to remove sign-compare warning
Date: Wed, 21 May 2025 16:13:52 -0300	[thread overview]
Message-ID: <20250521191352.30849-1-ocarneiro1@gmail.com> (raw)

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


             reply	other threads:[~2025-05-21 19:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-21 19:13 Octavio Carneiro [this message]
2025-05-21 23:08 ` [Newcomer][PATCH] graph.c: change graph_line->width type to int to remove sign-compare warning Junio C Hamano
2025-05-23  3:25   ` O. C.

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=20250521191352.30849-1-ocarneiro1@gmail.com \
    --to=ocarneiro1@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=ps@pks.im \
    /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;
as well as URLs for NNTP newsgroup(s).