summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-01-28 02:01:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-02-01 21:46:51 (GMT)
commit263434f20c20b193c1ef956eda43458b7f350eaa (patch)
tree7d357f279f17e600f0b7342af11227db4602b417
parent9c9b03b1f1fa84f4a723aac962e1126d27de4a4f (diff)
downloadgit-263434f20c20b193c1ef956eda43458b7f350eaa.zip
git-263434f20c20b193c1ef956eda43458b7f350eaa.tar.gz
git-263434f20c20b193c1ef956eda43458b7f350eaa.tar.bz2
attr.c: use strchrnul() to scan for one line
Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--attr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/attr.c b/attr.c
index 1fcf042..04d2433 100644
--- a/attr.c
+++ b/attr.c
@@ -402,8 +402,8 @@ static struct attr_stack *read_attr_from_index(const char *path, int macro_ok)
for (sp = buf; *sp; ) {
char *ep;
int more;
- for (ep = sp; *ep && *ep != '\n'; ep++)
- ;
+
+ ep = strchrnul(sp, '\n');
more = (*ep == '\n');
*ep = '\0';
handle_attr_line(res, sp, path, ++lineno, macro_ok);