commit.c: use strchrnul() to scan for one line
authorJunio C Hamano <gitster@pobox.com>
Sat, 28 Jan 2017 02:01:41 +0000 (18:01 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 1 Feb 2017 21:46:51 +0000 (13:46 -0800)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit.c
index 2cf85158b4899b664a3cbae8d0777f5a9e473318..0c4ee3de4228384d752a429f85b739864c26f457 100644 (file)
--- 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 = skip_blank_lines(p + 2);
-               for (eol = p; *eol && *eol != '\n'; eol++)
-                       ; /* do nothing */
+               eol = strchrnul(p, '\n');
        } else
                eol = p;