From: Arnav Bhate <bhatearnav@gmail.com>
To: git@vger.kernel.org
Subject: [GSoC PATCH] decorate: fix sign comparison warnings
Date: Mon, 10 Mar 2025 15:21:11 +0530 [thread overview]
Message-ID: <afa6b428-3190-42ae-9eac-540c95b576fd@gmail.com> (raw)
In two instances, an int was initialized and assigned the value of an
unsigned int. Then, the int was compared to unsigned ints.
Replace int with unsigned int in both cases.
Signed-off-by: Arnav Bhate <bhatearnav@gmail.com>
---
decorate.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/decorate.c b/decorate.c
index e161e13772..8d5774fcdd 100644
--- a/decorate.c
+++ b/decorate.c
@@ -3,8 +3,6 @@
* data.
*/
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "object.h"
#include "decorate.h"
@@ -16,7 +14,7 @@ static unsigned int hash_obj(const struct object *obj, unsigned int n)
static void *insert_decoration(struct decoration *n, const struct object *base, void *decoration)
{
- int size = n->size;
+ unsigned int size = n->size;
struct decoration_entry *entries = n->entries;
unsigned int j = hash_obj(base, size);
@@ -59,7 +57,7 @@ static void grow_decoration(struct decoration *n)
void *add_decoration(struct decoration *n, const struct object *obj,
void *decoration)
{
- int nr = n->nr + 1;
+ unsigned int nr = n->nr + 1;
if (nr > n->size * 2 / 3)
grow_decoration(n);
--
2.48.1
next reply other threads:[~2025-03-10 9:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-10 9:51 Arnav Bhate [this message]
2025-03-10 16:40 ` [GSoC PATCH] decorate: fix sign comparison warnings Junio C Hamano
2025-03-10 18:07 ` Arnav Bhate
2025-03-10 18:08 ` [GSoC PATCH v2] " Arnav Bhate
2025-03-10 21:02 ` Karthik Nayak
2025-03-11 18:26 ` Arnav Bhate
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=afa6b428-3190-42ae-9eac-540c95b576fd@gmail.com \
--to=bhatearnav@gmail.com \
--cc=git@vger.kernel.org \
/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).