]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin-for-each-ref.c
Use strchrnul() instead of strchr() plus manual workaround
[thirdparty/git.git] / builtin-for-each-ref.c
index be9dc9e3f0dbbd9bdda20db7fd5c5fad8e427bd2..72c087840c39bc03b142ba620f94800d40264eb9 100644 (file)
@@ -320,9 +320,7 @@ static const char *find_wholine(const char *who, int wholen, const char *buf, un
 
 static const char *copy_line(const char *buf)
 {
-       const char *eol = strchr(buf, '\n');
-       if (!eol) // simulate strchrnul()
-               eol = buf + strlen(buf);
+       const char *eol = strchrnul(buf, '\n');
        return xmemdupz(buf, eol - buf);
 }