git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "AtariDreams via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: AtariDreams <83477269+AtariDreams@users.noreply.github.com>,
	Seija Kijin <doremylover123@gmail.com>
Subject: [PATCH] Prefer fgetc over fgets where possible
Date: Mon, 17 Jul 2023 15:38:11 +0000	[thread overview]
Message-ID: <pull.1550.git.git.1689608291732.gitgitgadget@gmail.com> (raw)

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.

Signed-off-by: Seija Kijin doremylover123@gmail.com
---
    Prefer fgetc over fgets where possible
    
    fputc is meant for single characters, fputs is for strings. We are
    better off inserting sole \n characters as characters, not whole
    strings.
    
    Signed-off-by: Seija Kijin doremylover123@gmail.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1550%2FAtariDreams%2Ffgetc-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1550/AtariDreams/fgetc-v1
Pull-Request: https://github.com/git/git/pull/1550

 wt-status.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/wt-status.c b/wt-status.c
index 8a1a4fb1f04..4c267395cdf 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1215,7 +1215,7 @@ static void wt_longstatus_print_tracking(struct wt_status *s)
 		color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "%c",
 				 comment_line_char);
 	else
-		fputs("\n", s->fp);
+		fputc('\n', s->fp);
 	strbuf_release(&sb);
 }
 
@@ -1814,7 +1814,7 @@ static void wt_longstatus_print_state(struct wt_status *s)
 	if (state->merge_in_progress) {
 		if (state->rebase_interactive_in_progress) {
 			show_rebase_information(s, state_color);
-			fputs("\n", s->fp);
+			fputc('\n', s->fp);
 		}
 		show_merge_in_progress(s, state_color);
 	} else if (state->am_in_progress)

base-commit: 830b4a04c45bf0a6db26defe02ed1f490acd18ee
-- 
gitgitgadget

             reply	other threads:[~2023-07-17 15:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 15:38 AtariDreams via GitGitGadget [this message]
2023-07-17 16:51 ` [PATCH] Prefer fgetc over fgets where possible Junio C Hamano
2023-07-17 20:14 ` Taylor Blau
2024-12-18  1:16 ` [PATCH v2] " AreaZR via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.1550.git.git.1689608291732.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=83477269+AtariDreams@users.noreply.github.com \
    --cc=doremylover123@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).