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

Re: [PATCH] Prefer fgetc over fgets where possible

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 17, 2023, 16:51 UTC
Message-ID
<xmqq7cqyiiqp.fsf@gitster.g>
In-Reply-To
<pull.1550.git.git.1689608291732.gitgitgadget@gmail.com>
"AtariDreams via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 6 quoted lines
> From: Seija Kijin <doremylover123@gmail.com>
>
> fputc is meant for single characters,
> fputs is for strings. We are better off
> inserting sole \n characters as
> characters, not whole strings.

I do not see if these short lines are deliberate; are they meant to follow some sort of poetry styles?

In any case, while the above is correct, I do not see the patch noise is worth it in this particular case. Yes, if we are writing code snippets shown with the context in these hunks afresh, please carefully choose between fputs() and fputc(). But once the code is written and it is in, it is not worth to go back and fix it, unless we are fixing surrounding area and doing the clean-up as a "while at it" change.

By the way, because my mail program warned against an address that apparently refuses to receive any replies, I had to manually remove "AtariDreams <83477269+AtariDreams@users.noreply.github.com>" while composing this message. I'd appreciate it if you arrange to ensure that your next patch will not have such addresses on your CC: line.

Thanks.
Previous: AtariDreams via GitGitGadgetNext: Taylor Blau
Message 2 of 4 in “Prefer fgetc over fgets where possible”
  1. Prefer fgetc over fgets where possibleAtariDreams via GitGitGadget, Jul 17, 2023
  2. Junio C HamanoJul 17, 2023
  3. Taylor BlauJul 17, 2023
  4. Prefer fgetc over fgets where possibleAreaZR via GitGitGadget, Dec 18, 2024

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.