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>
Michael Haggerty committed
Aug 12, 2011 at 23:43 UTC
85c4a0d0482525480de4b575445ef8721858eff7
1 file changed
+5
-3
attr.c
+5
-3
@@ -192,7 +192,7 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
192
{
193
int namelen;
194
int num_attr;
195
- const char *cp, *name;
195
+ const char *cp, *name, *states;
196
struct match_attr *res = NULL;
197
int pass;
198
int is_macro;
@@ -223,11 +223,13 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
223
else
224
is_macro = 0;
225
226
+ states = name + namelen;
227
+ states += strspn(states, blank);
228
+
229
for (pass = 0; pass < 2; pass++) {
230
/* pass 0 counts and allocates, pass 1 fills */
231
num_attr = 0;
229
- cp = name + namelen;
230
- cp = cp + strspn(cp, blank);
232
+ cp = states;
233
while (*cp) {
234
cp = parse_attr(src, lineno, cp,
235
pass ? &(res->state[num_attr]) : NULL);