All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rose via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Rose <83477269+AtariDreams@users.noreply.github.com>,
	Seija Kijin <doremylover123@gmail.com>
Subject: [PATCH] grep: simplify is_empty_line
Date: Thu, 29 Dec 2022 16:58:42 +0000	[thread overview]
Message-ID: <pull.1418.git.git.1672333122193.gitgitgadget@gmail.com> (raw)

From: Seija Kijin <doremylover123@gmail.com>

Signed-off-by: Seija Kijin <doremylover123@gmail.com>
---
    grep: simplify is_empty_line
    
    Signed-off-by: Seija Kijin doremylover123@gmail.com

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

 grep.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/grep.c b/grep.c
index 06eed694936..f29f4dd9e08 100644
--- a/grep.c
+++ b/grep.c
@@ -1483,9 +1483,10 @@ static int fill_textconv_grep(struct repository *r,
 
 static int is_empty_line(const char *bol, const char *eol)
 {
-	while (bol < eol && isspace(*bol))
-		bol++;
-	return bol == eol;
+	while (bol < eol)
+		if (!isspace(*bol))
+			return 0;
+	return 1;
 }
 
 static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int collect_hits)

base-commit: 6bae53b138a1f38d8887f6b46d17661357a1468b
-- 
gitgitgadget

             reply	other threads:[~2022-12-29 16:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-29 16:58 Rose via GitGitGadget [this message]
2022-12-29 17:06 ` [PATCH] grep: simplify is_empty_line Eric Sunshine
2022-12-29 17:18 ` [PATCH v2] " Rose via GitGitGadget
2022-12-29 17:45   ` Eric Sunshine

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.1418.git.git.1672333122193.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.