]> asedeno.scripts.mit.edu Git - git.git/commitdiff
Use strchrnul() instead of strchr() plus manual workaround
authorJohan Herland <johan@herland.net>
Sat, 27 Sep 2008 22:24:36 +0000 (00:24 +0200)
committerShawn O. Pearce <spearce@spearce.org>
Mon, 29 Sep 2008 15:56:26 +0000 (08:56 -0700)
Also gets rid of a C++ comment.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
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);
 }