Skip to content

Commit

Permalink
Determine the start of the states outside of the pass loop
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed Aug 14, 2011
1 parent d175129 commit 85c4a0d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 85c4a0d

Please sign in to comment.