From: Patrick Steinhardt Date: Tue, 09 Sep 2025 06:23:05 GMT Subject: Re: [PATCH 3/4] string-list: change "string_list_find_insert_index" return type to "size_t" Message-ID: In-Reply-To: On Mon, Sep 08, 2025 at 12:42:37AM +0800, shejialuo wrote: > As "string_list_find_insert_index" is a simple wrapper of > "get_entry_index", we could simply change its return type to "size_t". The missing connecting piece is that `get_entry_index()` itself already returns a `size_t`. > diff --git a/mailmap.c b/mailmap.c > index 253517cdf6..0168342650 100644 > --- a/mailmap.c > +++ b/mailmap.c > @@ -266,7 +265,7 @@ static struct string_list_item *lookup_prefix(struct string_list *map, > * overlong key would be inserted, which must come after the > * real location of the key if one exists. > */ > - while (0 <= --i && i < map->nr) { > + while (i-- > 0 && i < map->nr) { This could simply be `while (i-- && i < map->nr)`. Patrick