git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 15, 2023, 19:09 UTC
Message-ID
<xmqq3565q1a1.fsf@gitster.g>
In-Reply-To
<pull.1399.v16.git.git.1678886439331.gitgitgadget@gmail.com>
"Rose via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 14 quoted lines
>       @@ 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.

Previous: Rose via GitGitGadget
Message 20 of 20 in “git: edit variable types to match what is assigned to them”
  1. git: edit variable types to match what is assigned to themRose via GitGitGadget, Dec 16, 2022
  2. Junio C HamanoDec 16, 2022
  3. git: edit variable types to match what is assigned to themRose via GitGitGadget, Dec 16, 2022
  4. git: edit variable types to match what is assigned to themRose via GitGitGadget, Dec 16, 2022
  5. Junio C HamanoDec 16, 2022
  6. git: edit variable types to match what is assigned to themRose via GitGitGadget, Dec 21, 2022
  7. git: edit variable types to match what is assigned to themRose via GitGitGadget, Dec 23, 2022
  8. git: edit variable types to match what is assigned to themRose via GitGitGadget, Dec 23, 2022
  9. git: edit variable types to match what is assigned to themRose via GitGitGadget, Dec 23, 2022
  10. git: edit variable types to match what is assigned to themRose via GitGitGadget, Dec 23, 2022
  11. git: edit variable types to match what is assigned to themRose via GitGitGadget, Dec 23, 2022
  12. git: edit variable types to match what is assigned to themRose via GitGitGadget, Dec 23, 2022
  13. git: edit variable types to match what is assigned to themRose via GitGitGadget, Dec 29, 2022
  14. git: edit variable types to match what is assigned to themRose via GitGitGadget, Dec 29, 2022
  15. git: edit variable types to match what is assigned to themRose via GitGitGadget, Jan 3, 2023
  16. git: change variable types to match what is assigned to themRose via GitGitGadget, Jan 8, 2023
  17. git: change variable types to match what is assigned to themRose via GitGitGadget, Jan 8, 2023
  18. git: change variable types to match what is assigned to themRose via GitGitGadget, Mar 15, 2023
  19. git: change variable types to match what is assigned to themRose via GitGitGadget, Mar 15, 2023
  20. Junio C HamanoMar 15, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.