aboutsummaryrefslogtreecommitdiffstats
path: root/t/helper/test-hash-speed.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-12-06 11:27:24 +0100
committerJunio C Hamano <gitster@pobox.com>2024-12-06 20:20:04 +0900
commit80c9e70ebe871f0826bc101142c66ff783405100 (patch)
treec95f04cef2dc0abb2d1fe8e4470e9e385e637b12 /t/helper/test-hash-speed.c
parent25435e4ad87aa484ce0d9d2adf3aa407f0241704 (diff)
downloadgit-80c9e70ebe871f0826bc101142c66ff783405100.tar.gz
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 <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper/test-hash-speed.c')
-rw-r--r--t/helper/test-hash-speed.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/t/helper/test-hash-speed.c b/t/helper/test-hash-speed.c
index 81a446dd64..80df1aae66 100644
--- a/t/helper/test-hash-speed.c
+++ b/t/helper/test-hash-speed.c
@@ -1,5 +1,3 @@
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "test-tool.h"
#include "hash.h"
@@ -18,12 +16,11 @@ int cmd__hash_speed(int ac, const char **av)
unsigned char hash[GIT_MAX_RAWSZ];
clock_t initial, start, end;
unsigned bufsizes[] = { 64, 256, 1024, 8192, 16384 };
- int i;
void *p;
const struct git_hash_algo *algo = NULL;
if (ac == 2) {
- for (i = 1; i < GIT_HASH_NALGOS; i++) {
+ for (size_t i = 1; i < GIT_HASH_NALGOS; i++) {
if (!strcmp(av[1], hash_algos[i].name)) {
algo = &hash_algos[i];
break;
@@ -38,7 +35,7 @@ int cmd__hash_speed(int ac, const char **av)
printf("algo: %s\n", algo->name);
- for (i = 0; i < ARRAY_SIZE(bufsizes); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(bufsizes); i++) {
unsigned long j, kb;
double kb_per_sec;
p = xcalloc(1, bufsizes[i]);