diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2011-08-12 23:43:08 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-08-14 15:02:00 -0700 |
commit | 85c4a0d0482525480de4b575445ef8721858eff7 (patch) | |
tree | c913416a2b299070790f63b67cd680383b4880f3 /attr.c | |
parent | d175129857fe712bc7a4d882b0b9ef9f9d0a337e (diff) | |
download | git-85c4a0d0482525480de4b575445ef8721858eff7.tar.gz |
Determine the start of the states outside of the pass loop
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'attr.c')
-rw-r--r-- | attr.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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); |