git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Aug 12, 2011, 21:43 UTC
Message-ID
<1313185390-19724-6-git-send-email-mhagger@alum.mit.edu>
In-Reply-To
<1313185390-19724-1-git-send-email-mhagger@alum.mit.edu>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
 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
Previous: Michael HaggertyNext: Michael Haggerty
Message 6 of 8 in “Comments and refactoring in attr.c”
  1. 0/7 Comments and refactoring in attr.cMichael Haggerty, Aug 12, 2011
  2. 1/7 Add a file commentMichael Haggerty, Aug 12, 2011
  3. 2/7 Document struct match_attrMichael Haggerty, Aug 12, 2011
  4. 3/7 Increment num_attr in parse_attr_line(), not parse_attr()Michael Haggerty, Aug 12, 2011
  5. 4/7 Change parse_attr() to take a pointer to struct attr_stateMichael Haggerty, Aug 12, 2011
  6. 5/7 Determine the start of the states outside of the pass loopMichael Haggerty, Aug 12, 2011
  7. 6/7 Change while loop into for loopMichael Haggerty, Aug 12, 2011
  8. 7/7 Unroll the loop over passesMichael Haggerty, Aug 12, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.