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

[PATCH] commit.c: use strchrnul() to scan for one line

From
Junio C Hamano <gitster@pobox.com>
Date
May 15, 2016, 22:23 UTC
Message-ID
<xmqq37pj55bg.fsf@gitster.mtv.corp.google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 commit.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/commit.c b/commit.c
index 3f4f371..1f9ee8a 100644
--- a/commit.c
+++ b/commit.c
@@ -415,8 +415,7 @@ int find_commit_subject(const char *commit_buffer, const char **subject)
 		p++;
 	if (*p) {
 		p += 2;
-		for (eol = p; *eol && *eol != '\n'; eol++)
-			; /* do nothing */
+		eol = strchrnul(p, '\n');
 	} else
 		eol = p;
 
-- 
2.8.2-748-gfb85f76
Next: Johannes Schindelin
Message 1 of 3 in “commit.c: use strchrnul() to scan for one line”
  1. commit.c: use strchrnul() to scan for one lineJunio C Hamano, May 15, 2016
  2. Johannes SchindelinMay 16, 2016
  3. Junio C HamanoMay 16, 2016

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.