aboutsummaryrefslogtreecommitdiffstats
path: root/refs.c
diff options
context:
space:
mode:
authorshejialuo <shejialuo@gmail.com>2025-10-06 14:32:40 +0800
committerJunio C Hamano <gitster@pobox.com>2025-10-06 09:11:07 -0700
commit51c3385e3736aeb5f78cc9ed193779e2cb4a2a29 (patch)
tree7fa12176e859434789d45fc3f4bee59e1b8ad8a8 /refs.c
parentstring-list: replace negative index encoding with "exact_match" parameter (diff)
downloadgit-51c3385e3736aeb5f78cc9ed193779e2cb4a2a29.tar.gz
git-51c3385e3736aeb5f78cc9ed193779e2cb4a2a29.zip
string-list: change "string_list_find_insert_index" return type to "size_t"
As "string_list_find_insert_index" is a simple wrapper of "get_entry_index" and the return type of "get_entry_index" is already "size_t", we could simply change its return type to "size_t". Update all callers to use size_t variables for storing the return value. The tricky fix is the loop condition in "mailmap.c" to properly handle "size_t" underflow by changing from `0 <= --i` to `i--`. Remove "DISABLE_SIGN_COMPARE_WARNINGS" from "mailmap.c" as it's no longer needed with the proper unsigned types. Signed-off-by: shejialuo <shejialuo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/refs.c b/refs.c
index f1ff5bf846..a8f06b9a0a 100644
--- a/refs.c
+++ b/refs.c
@@ -1688,8 +1688,6 @@ const char *find_descendant_ref(const char *dirname,
const struct string_list *extras,
const struct string_list *skip)
{
- int pos;
-
if (!extras)
return NULL;
@@ -1699,7 +1697,7 @@ const char *find_descendant_ref(const char *dirname,
* with dirname (remember, dirname includes the trailing
* slash) and is not in skip, then we have a conflict.
*/
- for (pos = string_list_find_insert_index(extras, dirname, NULL);
+ for (size_t pos = string_list_find_insert_index(extras, dirname, NULL);
pos < extras->nr; pos++) {
const char *extra_refname = extras->items[pos].string;