Skip to contentSkip to conversation

attr.c: use strchrnul() to scan for one line

PATCH Superseded Junio C Hamano 1 participant 1 message Jun 16, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 attr.c: use strchrnul() to scan for one line

---
 attr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
attr.c +2 -2
index a19946a..a7f2c3f 100644
@@ -407,8 +407,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);
Signature · 1 line
2.8.2-748-gfb85f76