git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] grep: simplify is_empty_line
@ 2022-12-29 16:58 Rose via GitGitGadget
  2022-12-29 17:06 ` Eric Sunshine
  2022-12-29 17:18 ` [PATCH v2] " Rose via GitGitGadget
  0 siblings, 2 replies; 4+ messages in thread
From: Rose via GitGitGadget @ 2022-12-29 16:58 UTC (permalink / raw)
  To: git; +Cc: Rose, Seija Kijin

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-29 17:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-29 16:58 [PATCH] grep: simplify is_empty_line Rose via GitGitGadget
2022-12-29 17:06 ` Eric Sunshine
2022-12-29 17:18 ` [PATCH v2] " Rose via GitGitGadget
2022-12-29 17:45   ` Eric Sunshine

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).