diff options
author | Johan Herland <johan@herland.net> | 2008-09-28 00:24:36 +0200 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2008-09-29 08:56:26 -0700 |
commit | 94e02e7f3b0504243b364ad04b58332bb1502934 (patch) | |
tree | cf7f4d48d75073724235667f437f72512fbd6311 /builtin-for-each-ref.c | |
parent | Use remove_path from dir.c instead of own implementation (diff) | |
download | tgif-94e02e7f3b0504243b364ad04b58332bb1502934.tar.xz |
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>
Diffstat (limited to 'builtin-for-each-ref.c')
-rw-r--r-- | builtin-for-each-ref.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c index be9dc9e3f0..72c087840c 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); } |