From: Johan Herland Date: Sat, 27 Sep 2008 22:24:36 +0000 (+0200) Subject: Use strchrnul() instead of strchr() plus manual workaround X-Git-Tag: v1.6.0.3~55 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=94e02e7f3b0504243b364ad04b58332bb1502934;p=git.git Use strchrnul() instead of strchr() plus manual workaround Also gets rid of a C++ comment. Signed-off-by: Johan Herland Signed-off-by: Shawn O. Pearce --- diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c index be9dc9e3f..72c087840 100644 --- a/builtin-for-each-ref.c +++ b/builtin-for-each-ref.c @@ -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); }