From 80c9e70ebe871f0826bc101142c66ff783405100 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Fri, 6 Dec 2024 11:27:24 +0100 Subject: global: trivial conversions to fix `-Wsign-compare` warnings We have a bunch of loops which iterate up to an unsigned boundary using a signed index, which generates warnigs because we compare a signed and unsigned value in the loop condition. Address these sites for trivial cases and enable `-Wsign-compare` warnings for these code units. This patch only adapts those code units where we can drop the `DISABLE_SIGN_COMPARE_WARNINGS` macro in the same step. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- refs/debug.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'refs/debug.c') diff --git a/refs/debug.c b/refs/debug.c index 89fbd59320..fbc4df08b4 100644 --- a/refs/debug.c +++ b/refs/debug.c @@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS - #include "git-compat-util.h" #include "hex.h" #include "refs-internal.h" @@ -85,9 +83,8 @@ static void print_update(int i, const char *refname, static void print_transaction(struct ref_transaction *transaction) { - int i; trace_printf_key(&trace_refs, "transaction {\n"); - for (i = 0; i < transaction->nr; i++) { + for (size_t i = 0; i < transaction->nr; i++) { struct ref_update *u = transaction->updates[i]; print_update(i, u->refname, &u->old_oid, &u->new_oid, u->flags, u->type, u->msg); -- cgit 1.2.3-korg