From: Junio C Hamano Date: Sat, 28 Jan 2017 02:01:42 +0000 (-0800) Subject: attr.c: use strchrnul() to scan for one line X-Git-Tag: v2.13.0-rc0~169^2~25 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=263434f20c20b193c1ef956eda43458b7f350eaa;p=git attr.c: use strchrnul() to scan for one line Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller Signed-off-by: Brandon Williams Signed-off-by: Junio C Hamano --- diff --git a/attr.c b/attr.c index 1fcf042b87..04d24334e8 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);