summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ba845b7)
raw | patch | inline | side by side (parent: ba845b7)
author | Michael Haggerty <mhagger@alum.mit.edu> | |
Fri, 12 Aug 2011 21:43:06 +0000 (23:43 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 14 Aug 2011 22:01:58 +0000 (15:01 -0700) |
num_attr is incremented iff parse_attr() returns non-NULL. So do the
counting in parse_attr_line() instead of within parse_attr(). This
allows an integer rather than a pointer to an integer to be passed to
parse_attr().
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
counting in parse_attr_line() instead of within parse_attr(). This
allows an integer rather than a pointer to an integer to be passed to
parse_attr().
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
attr.c | patch | blob | history |
index c33e4135c3aa8c4713f5c813b4fe08ccf4bd7110..cac550decd477525560423f6118c1aa2ca91e6d1 100644 (file)
--- a/attr.c
+++ b/attr.c
static const char blank[] = " \t\r\n";
static const char *parse_attr(const char *src, int lineno, const char *cp,
- int *num_attr, struct match_attr *res)
+ int num_attr, struct match_attr *res)
{
const char *ep, *equals;
int len;
} else {
struct attr_state *e;
- e = &(res->state[*num_attr]);
+ e = &(res->state[num_attr]);
if (*cp == '-' || *cp == '!') {
e->setto = (*cp == '-') ? ATTR__FALSE : ATTR__UNSET;
cp++;
}
e->attr = git_attr_internal(cp, len);
}
- (*num_attr)++;
return ep + strspn(ep, blank);
}
cp = name + namelen;
cp = cp + strspn(cp, blank);
while (*cp) {
- cp = parse_attr(src, lineno, cp, &num_attr, res);
+ cp = parse_attr(src, lineno, cp, num_attr, res);
if (!cp)
return NULL;
+ num_attr++;
}
if (pass)
break;