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>
Junio C Hamano committed
Jan 27, 2017 at 18:01 UTC
263434f20c20b193c1ef956eda43458b7f350eaa
1 file changed
+2
-2
attr.c
+2
-2
@@ -402,8 +402,8 @@ static struct attr_stack *read_attr_from_index(const char *path, int macro_ok)
402
for (sp = buf; *sp; ) {
403
char *ep;
404
int more;
405
- for (ep = sp; *ep && *ep != '\n'; ep++)
406
- ;
405
+
406
+ ep = strchrnul(sp, '\n');
407
more = (*ep == '\n');
408
*ep = '\0';
409
handle_attr_line(res, sp, path, ++lineno, macro_ok);