Subject: Re: [PATCH v16] git: change variable types to match what is assigned to them

From: Junio C Hamano <[email-masked]>
Date: Wed, 15 Mar 2023 12:09:58 -0700

"Rose via GitGitGadget" <[email-masked]> writes:

>       @@ add-interactive.c: static ssize_t find_unique(const char *string, struct prefix_item_list *list)
>      @@ advice.c: void advise_if_enabled(enum advice_type type, const char *advice, ...)
>        
>        	if (!strcmp(var, "color.advice")) {
>        		advice_use_color = git_config_colorbool(var, value);
>      +@@ advice.c: int git_default_advice_config(const char *var, const char *value)
>      + 
>      + void list_config_advices(struct string_list *list, const char *prefix)
>      + {
>      +-	int i;
>      ++	size_t i;
>      + 
>      + 	for (i = 0; i < ARRAY_SIZE(advice_setting); i++)
>      + 		list_config_item(list, prefix, advice_setting[i].key);

Here, the advice_setting[] is not an attacker controlled array with
an unbound size.  It is a known static array the program prepares.
Converting it to use size_t as an index is a totally pointless
churn.

Some of the changes in this patch may have merit, but seeing a
change like this as the first change in the iteration makes me lose
interest in reading this huge message that weighs more than 7000
lines.  If you are looking for "for (x = 0;" where x is declared of
any type other than size_t and blindly converting them, please stop.