git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "AreaZR via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: AreaZR <gfunni234@gmail.com>, Seija Kijin <doremylover123@gmail.com>
Subject: [PATCH v3] git: use signed loop counters when comparing with signed vars
Date: Wed, 18 Dec 2024 03:10:22 +0000	[thread overview]
Message-ID: <pull.1843.v3.git.git.1734491422385.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1843.v2.git.git.1734485729135.gitgitgadget@gmail.com>

From: Seija Kijin <doremylover123@gmail.com>

The compiler (at least LLVM) treats them better anyway
because of the C standard not defining signed overflow.

Signed-off-by: Seija Kijin <doremylover123@gmail.com>
---
    git: use signed loop counters when comparing with signed vars
    
    The compiler (at least LLVM) treats them better anyway because of the C
    standard not defining signed overflow.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1843%2FAreaZR%2Fone-more-time-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1843/AreaZR/one-more-time-v3
Pull-Request: https://github.com/git/git/pull/1843

Range-diff vs v2:

 1:  c8552548fe9 = 1:  754e4a60ff6 git: use signed loop counters when comparing with signed vars


 add-interactive.c | 2 +-
 bloom.c           | 2 +-
 git.c             | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/add-interactive.c b/add-interactive.c
index 49042b30261..12c23fa10ba 100644
--- a/add-interactive.c
+++ b/add-interactive.c
@@ -848,7 +848,7 @@ static int get_untracked_files(struct repository *r,
 			       const struct pathspec *ps)
 {
 	struct dir_struct dir = { 0 };
-	size_t i;
+	int i;
 	struct strbuf buf = STRBUF_INIT;
 
 	if (repo_read_index(r) < 0)
diff --git a/bloom.c b/bloom.c
index c4286341059..42db509bea9 100644
--- a/bloom.c
+++ b/bloom.c
@@ -314,7 +314,7 @@ static int has_entries_with_high_bit(struct repository *r, struct tree *t)
 
 		init_tree_desc(&desc, &t->object.oid, t->buffer, t->size);
 		while (tree_entry(&desc, &entry)) {
-			size_t i;
+			int i;
 			for (i = 0; i < entry.pathlen; i++) {
 				if (entry.path[i] & 0x80) {
 					t->object.flags |= HIGH_BITS;
diff --git a/git.c b/git.c
index 46b3c740c5d..86f7112f4bf 100644
--- a/git.c
+++ b/git.c
@@ -946,7 +946,7 @@ int cmd_main(int argc, const char **argv)
 	 */
 	setup_path();
 
-	for (size_t i = 0; i < argc; i++)
+	for (int i = 0; i < argc; i++)
 		strvec_push(&args, argv[i]);
 
 	while (1) {

base-commit: d882f382b3d939d90cfa58d17b17802338f05d66
-- 
gitgitgadget

      reply	other threads:[~2024-12-18  3:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18  0:15 [PATCH] git: use signed counters when comparing with signed vars AreaZR via GitGitGadget
2024-12-18  1:35 ` [PATCH v2] git: use signed loop " AreaZR via GitGitGadget
2024-12-18  3:10   ` AreaZR via GitGitGadget [this message]

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=pull.1843.v3.git.git.1734491422385.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=doremylover123@gmail.com \
    --cc=gfunni234@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).