{"thread":{"id":"62660","subject":"[PATCH] git: use signed counters when comparing with signed vars","startedAt":"2024-12-18T00:15:56Z","lastAt":"2024-12-18T03:10:25Z","messageCount":3,"participants":["AreaZR via GitGitGadget"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"509245","messageId":"pull.1843.git.git.1734480952423.gitgitgadget@gmail.com","threadId":"62660","inReplyTo":null,"subject":"[PATCH] git: use signed counters when comparing with signed vars","fromName":"AreaZR via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-12-18T00:15:52Z","receivedAt":"2024-12-18T00:15:56Z","isPatch":true,"sender":{"key":"name:AreaZR","avatar":null},"body":"From: Seija Kijin <doremylover123@gmail.com>\n\nThe compiler (at least LLVM) treats them better anyway\nbecause of the C standard not defining signed overflow.\n\nSigned-off-by: Seija Kijin <doremylover123@gmail.com>\n---\n    git: use signed counters when comparing with signed vars\n    \n    The compiler (at least LLVM) treats them better anyway because of the C\n    standard not defining signed overflow.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1843%2FAreaZR%2Fone-more-time-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1843/AreaZR/one-more-time-v1\nPull-Request: https://github.com/git/git/pull/1843\n\n add-interactive.c | 2 +-\n bloom.c           | 2 +-\n git.c             | 2 +-\n 3 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/add-interactive.c b/add-interactive.c\nindex 49042b30261..12c23fa10ba 100644\n--- a/add-interactive.c\n+++ b/add-interactive.c\n@@ -848,7 +848,7 @@ static int get_untracked_files(struct repository *r,\n \t\t\t       const struct pathspec *ps)\n {\n \tstruct dir_struct dir = { 0 };\n-\tsize_t i;\n+\tint i;\n \tstruct strbuf buf = STRBUF_INIT;\n \n \tif (repo_read_index(r) < 0)\ndiff --git a/bloom.c b/bloom.c\nindex c4286341059..42db509bea9 100644\n--- a/bloom.c\n+++ b/bloom.c\n@@ -314,7 +314,7 @@ static int has_entries_with_high_bit(struct repository *r, struct tree *t)\n \n \t\tinit_tree_desc(&desc, &t->object.oid, t->buffer, t->size);\n \t\twhile (tree_entry(&desc, &entry)) {\n-\t\t\tsize_t i;\n+\t\t\tint i;\n \t\t\tfor (i = 0; i < entry.pathlen; i++) {\n \t\t\t\tif (entry.path[i] & 0x80) {\n \t\t\t\t\tt->object.flags |= HIGH_BITS;\ndiff --git a/git.c b/git.c\nindex 46b3c740c5d..86f7112f4bf 100644\n--- a/git.c\n+++ b/git.c\n@@ -946,7 +946,7 @@ int cmd_main(int argc, const char **argv)\n \t */\n \tsetup_path();\n \n-\tfor (size_t i = 0; i < argc; i++)\n+\tfor (int i = 0; i < argc; i++)\n \t\tstrvec_push(&args, argv[i]);\n \n \twhile (1) {\n\nbase-commit: 2ccc89b0c16c51561da90d21cfbb4b58cc877bf6\n-- \ngitgitgadget\n"},{"id":"509263","messageId":"pull.1843.v2.git.git.1734485729135.gitgitgadget@gmail.com","threadId":"62660","inReplyTo":"pull.1843.git.git.1734480952423.gitgitgadget@gmail.com","subject":"[PATCH v2] git: use signed loop counters when comparing with signed vars","fromName":"AreaZR via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-12-18T01:35:29Z","receivedAt":"2024-12-18T01:35:32Z","isPatch":true,"sender":{"key":"name:AreaZR","avatar":null},"body":"From: Seija Kijin <doremylover123@gmail.com>\n\nThe compiler (at least LLVM) treats them better anyway\nbecause of the C standard not defining signed overflow.\n\nSigned-off-by: Seija Kijin <doremylover123@gmail.com>\n---\n    git: use signed loop counters when comparing with signed vars\n    \n    The compiler (at least LLVM) treats them better anyway because of the C\n    standard not defining signed overflow.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1843%2FAreaZR%2Fone-more-time-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1843/AreaZR/one-more-time-v2\nPull-Request: https://github.com/git/git/pull/1843\n\nRange-diff vs v1:\n\n 1:  1dea0ce98b4 ! 1:  c8552548fe9 git: use signed counters when comparing with signed vars\n     @@ Metadata\n      Author: Seija Kijin <doremylover123@gmail.com>\n      \n       ## Commit message ##\n     -    git: use signed counters when comparing with signed vars\n     +    git: use signed loop counters when comparing with signed vars\n      \n          The compiler (at least LLVM) treats them better anyway\n          because of the C standard not defining signed overflow.\n\n\n add-interactive.c | 2 +-\n bloom.c           | 2 +-\n git.c             | 2 +-\n 3 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/add-interactive.c b/add-interactive.c\nindex 49042b30261..12c23fa10ba 100644\n--- a/add-interactive.c\n+++ b/add-interactive.c\n@@ -848,7 +848,7 @@ static int get_untracked_files(struct repository *r,\n \t\t\t       const struct pathspec *ps)\n {\n \tstruct dir_struct dir = { 0 };\n-\tsize_t i;\n+\tint i;\n \tstruct strbuf buf = STRBUF_INIT;\n \n \tif (repo_read_index(r) < 0)\ndiff --git a/bloom.c b/bloom.c\nindex c4286341059..42db509bea9 100644\n--- a/bloom.c\n+++ b/bloom.c\n@@ -314,7 +314,7 @@ static int has_entries_with_high_bit(struct repository *r, struct tree *t)\n \n \t\tinit_tree_desc(&desc, &t->object.oid, t->buffer, t->size);\n \t\twhile (tree_entry(&desc, &entry)) {\n-\t\t\tsize_t i;\n+\t\t\tint i;\n \t\t\tfor (i = 0; i < entry.pathlen; i++) {\n \t\t\t\tif (entry.path[i] & 0x80) {\n \t\t\t\t\tt->object.flags |= HIGH_BITS;\ndiff --git a/git.c b/git.c\nindex 46b3c740c5d..86f7112f4bf 100644\n--- a/git.c\n+++ b/git.c\n@@ -946,7 +946,7 @@ int cmd_main(int argc, const char **argv)\n \t */\n \tsetup_path();\n \n-\tfor (size_t i = 0; i < argc; i++)\n+\tfor (int i = 0; i < argc; i++)\n \t\tstrvec_push(&args, argv[i]);\n \n \twhile (1) {\n\nbase-commit: 063bcebf0c917140ca0e705cbe0fdea127e90086\n-- \ngitgitgadget\n"},{"id":"509270","messageId":"pull.1843.v3.git.git.1734491422385.gitgitgadget@gmail.com","threadId":"62660","inReplyTo":"pull.1843.v2.git.git.1734485729135.gitgitgadget@gmail.com","subject":"[PATCH v3] git: use signed loop counters when comparing with signed vars","fromName":"AreaZR via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-12-18T03:10:22Z","receivedAt":"2024-12-18T03:10:25Z","isPatch":true,"sender":{"key":"name:AreaZR","avatar":null},"body":"From: Seija Kijin <doremylover123@gmail.com>\n\nThe compiler (at least LLVM) treats them better anyway\nbecause of the C standard not defining signed overflow.\n\nSigned-off-by: Seija Kijin <doremylover123@gmail.com>\n---\n    git: use signed loop counters when comparing with signed vars\n    \n    The compiler (at least LLVM) treats them better anyway because of the C\n    standard not defining signed overflow.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1843%2FAreaZR%2Fone-more-time-v3\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1843/AreaZR/one-more-time-v3\nPull-Request: https://github.com/git/git/pull/1843\n\nRange-diff vs v2:\n\n 1:  c8552548fe9 = 1:  754e4a60ff6 git: use signed loop counters when comparing with signed vars\n\n\n add-interactive.c | 2 +-\n bloom.c           | 2 +-\n git.c             | 2 +-\n 3 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/add-interactive.c b/add-interactive.c\nindex 49042b30261..12c23fa10ba 100644\n--- a/add-interactive.c\n+++ b/add-interactive.c\n@@ -848,7 +848,7 @@ static int get_untracked_files(struct repository *r,\n \t\t\t       const struct pathspec *ps)\n {\n \tstruct dir_struct dir = { 0 };\n-\tsize_t i;\n+\tint i;\n \tstruct strbuf buf = STRBUF_INIT;\n \n \tif (repo_read_index(r) < 0)\ndiff --git a/bloom.c b/bloom.c\nindex c4286341059..42db509bea9 100644\n--- a/bloom.c\n+++ b/bloom.c\n@@ -314,7 +314,7 @@ static int has_entries_with_high_bit(struct repository *r, struct tree *t)\n \n \t\tinit_tree_desc(&desc, &t->object.oid, t->buffer, t->size);\n \t\twhile (tree_entry(&desc, &entry)) {\n-\t\t\tsize_t i;\n+\t\t\tint i;\n \t\t\tfor (i = 0; i < entry.pathlen; i++) {\n \t\t\t\tif (entry.path[i] & 0x80) {\n \t\t\t\t\tt->object.flags |= HIGH_BITS;\ndiff --git a/git.c b/git.c\nindex 46b3c740c5d..86f7112f4bf 100644\n--- a/git.c\n+++ b/git.c\n@@ -946,7 +946,7 @@ int cmd_main(int argc, const char **argv)\n \t */\n \tsetup_path();\n \n-\tfor (size_t i = 0; i < argc; i++)\n+\tfor (int i = 0; i < argc; i++)\n \t\tstrvec_push(&args, argv[i]);\n \n \twhile (1) {\n\nbase-commit: d882f382b3d939d90cfa58d17b17802338f05d66\n-- \ngitgitgadget\n"}]}