Thread (8 messages) flat view 8 messages, 1 author, 2016-06-15
DORMANTno replies

[PATCH 5/7] Determine the start of the states outside of the pass loop

From: Michael Haggerty <hidden>
Date: 2016-06-15 22:51:48
Subsystem: the rest · Maintainer: Linus Torvalds

Signed-off-by: Michael Haggerty <redacted>
---
 attr.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/attr.c b/attr.c
index f23f62a..a7d1aa9 100644
--- a/attr.c
+++ b/attr.c
@@ -192,7 +192,7 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
 {
 	int namelen;
 	int num_attr;
-	const char *cp, *name;
+	const char *cp, *name, *states;
 	struct match_attr *res = NULL;
 	int pass;
 	int is_macro;
@@ -223,11 +223,13 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
 	else
 		is_macro = 0;
 
+	states = name + namelen;
+	states += strspn(states, blank);
+
 	for (pass = 0; pass < 2; pass++) {
 		/* pass 0 counts and allocates, pass 1 fills */
 		num_attr = 0;
-		cp = name + namelen;
-		cp = cp + strspn(cp, blank);
+		cp = states;
 		while (*cp) {
 			cp = parse_attr(src, lineno, cp,
 				pass ? &(res->state[num_attr]) : NULL);
-- 
1.7.6.8.gd2879
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help