diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-03-10 08:13:30 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-03-10 13:16:20 -0700 |
| commit | 8ca9fa60a63c97bb9397f5de294aef53df90e7a0 (patch) | |
| tree | b1ee7b6f1abf0d028abcbbca0486db6d3d46de27 /hash.c | |
| parent | 172d0f686b07a73cba2d307b2abf08e2819a77e1 (diff) | |
| download | git-8ca9fa60a63c97bb9397f5de294aef53df90e7a0.tar.xz | |
hash: fix "-Wsign-compare" warnings
There are a couple of trivial "-Wsign-compare" warnings in "hash.c". Fix
them.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'hash.c')
| -rw-r--r-- | hash.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -1,5 +1,4 @@ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "hash.h" @@ -246,10 +245,9 @@ const char *empty_tree_oid_hex(const struct git_hash_algo *algop) int hash_algo_by_name(const char *name) { - int i; if (!name) return GIT_HASH_UNKNOWN; - for (i = 1; i < GIT_HASH_NALGOS; i++) + for (size_t i = 1; i < GIT_HASH_NALGOS; i++) if (!strcmp(name, hash_algos[i].name)) return i; return GIT_HASH_UNKNOWN; @@ -257,17 +255,15 @@ int hash_algo_by_name(const char *name) int hash_algo_by_id(uint32_t format_id) { - int i; - for (i = 1; i < GIT_HASH_NALGOS; i++) + for (size_t i = 1; i < GIT_HASH_NALGOS; i++) if (format_id == hash_algos[i].format_id) return i; return GIT_HASH_UNKNOWN; } -int hash_algo_by_length(int len) +int hash_algo_by_length(size_t len) { - int i; - for (i = 1; i < GIT_HASH_NALGOS; i++) + for (size_t i = 1; i < GIT_HASH_NALGOS; i++) if (len == hash_algos[i].rawsz) return i; return GIT_HASH_UNKNOWN; |
