From 51c3385e3736aeb5f78cc9ed193779e2cb4a2a29 Mon Sep 17 00:00:00 2001 From: shejialuo Date: Mon, 6 Oct 2025 14:32:40 +0800 Subject: 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 Signed-off-by: Junio C Hamano --- string-list.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'string-list.c') diff --git a/string-list.c b/string-list.c index c589ab5a2c..08dc00984c 100644 --- a/string-list.c +++ b/string-list.c @@ -91,8 +91,8 @@ bool string_list_has_string(const struct string_list *list, const char *string) return exact_match; } -int string_list_find_insert_index(const struct string_list *list, const char *string, - bool *exact_match) +size_t string_list_find_insert_index(const struct string_list *list, const char *string, + bool *exact_match) { return get_entry_index(list, string, exact_match); } -- cgit v1.2.3