@matheusbsbs / matheus-bagliano / commits / 94e02e7f3b
Fork 0

Use strchrnul() instead of strchr() plus manual workaround

Also gets rid of a C++ comment. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Johan Herland committed Sep 28, 2008 at 00:24 UTC 94e02e7f3b0504243b364ad04b58332bb1502934
1 file changed +1 -3
builtin-for-each-ref.c
+1 -3
@@ -320,9 +320,7 @@ static const char *find_wholine(const char *who, int wholen, const char *buf, un
320
321 static const char *copy_line(const char *buf)
322 {
323 - const char *eol = strchr(buf, '\n');
324 - if (!eol) // simulate strchrnul()
325 - eol = buf + strlen(buf);
323 + const char *eol = strchrnul(buf, '\n');
324 return xmemdupz(buf, eol - buf);
325 }
326