summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-12-06 11:27:21 +0100
committerJunio C Hamano <gitster@pobox.com>2024-12-06 20:20:03 +0900
commit47d72a74a737f06791c282a75baf2c573cdf42f6 (patch)
treeb5c04796ba6e418f79f9621bff13900442e956b3
parent4f9264b0cdf588745ebd71638a216e626b89df35 (diff)
diff.h: fix index used to loop through unsigned integer
The `struct diff_flags` structure is essentially an array of flags, all of which have the same type. We can thus use `sizeof()` to iterate through all of the flags, which we do in `diff_flags_or()`. But while the statement returns an unsigned integer, we used a signed integer to iterate through the flags, which generates a warning. Fix this by using `size_t` for the index instead. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/am.c1
-rw-r--r--builtin/diff-tree.c1
-rw-r--r--builtin/merge-ours.c1
-rw-r--r--builtin/pack-refs.c1
-rw-r--r--builtin/range-diff.c1
-rw-r--r--builtin/reflog.c1
-rw-r--r--builtin/reset.c1
-rw-r--r--builtin/revert.c1
-rw-r--r--builtin/shortlog.c1
-rw-r--r--diff-merges.c2
-rw-r--r--diff.h3
-rw-r--r--diffcore-order.c2
-rw-r--r--diffcore-rotate.c2
-rw-r--r--list-objects-filter.c1
-rw-r--r--patch-ids.c2
-rw-r--r--reachable.c1
-rw-r--r--reflog-walk.c1
-rw-r--r--t/helper/test-revision-walking.c1
18 files changed, 1 insertions, 23 deletions
diff --git a/builtin/am.c b/builtin/am.c
index f3b6546b30..1338b606fe 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -5,7 +5,6 @@
*/
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index a4df2d0c13..40804e7b48 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -1,5 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
diff --git a/builtin/merge-ours.c b/builtin/merge-ours.c
index 3672c6353f..3ecd9172f1 100644
--- a/builtin/merge-ours.c
+++ b/builtin/merge-ours.c
@@ -9,7 +9,6 @@
*/
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "builtin.h"
diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c
index 71175a713a..4fdd68880e 100644
--- a/builtin/pack-refs.c
+++ b/builtin/pack-refs.c
@@ -1,5 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
diff --git a/builtin/range-diff.c b/builtin/range-diff.c
index aa88a46d9e..433c305fc5 100644
--- a/builtin/range-diff.c
+++ b/builtin/range-diff.c
@@ -1,5 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "gettext.h"
diff --git a/builtin/reflog.c b/builtin/reflog.c
index 08e99a22b0..95f264989b 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -1,5 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
diff --git a/builtin/reset.c b/builtin/reset.c
index f34d22190f..73b4537a9a 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -9,7 +9,6 @@
*/
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "advice.h"
diff --git a/builtin/revert.c b/builtin/revert.c
index 4b57c2c383..aca6c293cd 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -1,5 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "builtin.h"
diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index 1c46f13a16..30075b67be 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -1,5 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
diff --git a/diff-merges.c b/diff-merges.c
index 0adfe7f5c0..45507588a2 100644
--- a/diff-merges.c
+++ b/diff-merges.c
@@ -1,5 +1,3 @@
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "diff-merges.h"
diff --git a/diff.h b/diff.h
index 5c8de79535..6e6007c17b 100644
--- a/diff.h
+++ b/diff.h
@@ -205,9 +205,8 @@ static inline void diff_flags_or(struct diff_flags *a,
{
char *tmp_a = (char *)a;
const char *tmp_b = (const char *)b;
- int i;
- for (i = 0; i < sizeof(struct diff_flags); i++)
+ for (size_t i = 0; i < sizeof(struct diff_flags); i++)
tmp_a[i] |= tmp_b[i];
}
diff --git a/diffcore-order.c b/diffcore-order.c
index ec59d3d9bc..f91ef22471 100644
--- a/diffcore-order.c
+++ b/diffcore-order.c
@@ -2,8 +2,6 @@
* Copyright (C) 2005 Junio C Hamano
*/
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "gettext.h"
#include "diff.h"
diff --git a/diffcore-rotate.c b/diffcore-rotate.c
index 941a022d5e..67b591261a 100644
--- a/diffcore-rotate.c
+++ b/diffcore-rotate.c
@@ -3,8 +3,6 @@
* Based on diffcore-order.c, which is Copyright (C) 2005, Junio C Hamano
*/
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "gettext.h"
#include "diff.h"
diff --git a/list-objects-filter.c b/list-objects-filter.c
index 4afa3029dc..dc598a081b 100644
--- a/list-objects-filter.c
+++ b/list-objects-filter.c
@@ -1,5 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "dir.h"
diff --git a/patch-ids.c b/patch-ids.c
index 8b89198073..a5683b462c 100644
--- a/patch-ids.c
+++ b/patch-ids.c
@@ -1,5 +1,3 @@
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "diff.h"
#include "commit.h"
diff --git a/reachable.c b/reachable.c
index 34079e1ae9..3e9b3dd0a4 100644
--- a/reachable.c
+++ b/reachable.c
@@ -1,5 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "gettext.h"
diff --git a/reflog-walk.c b/reflog-walk.c
index b53628ed53..c7070b13b0 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -1,5 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "commit.h"
diff --git a/t/helper/test-revision-walking.c b/t/helper/test-revision-walking.c
index 3b931a34a2..071f5bd1e2 100644
--- a/t/helper/test-revision-walking.c
+++ b/t/helper/test-revision-walking.c
@@ -9,7 +9,6 @@
*/
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-tool.h"
#include "commit.h"