Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/attr.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2011-08-13 01:43:06 +0400
committerJunio C Hamano <gitster@pobox.com>2011-08-15 02:01:58 +0400
commit4c7517c9cc7cfc7961a5c31d7539a71f35fae2c2 (patch)
tree20ba9e36433c54f189302009cae318a60e0a79fb /attr.c
parentba845b755078a043312119609c1ddd7406b20979 (diff)
Increment num_attr in parse_attr_line(), not parse_attr()
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>
Diffstat (limited to 'attr.c')
-rw-r--r--attr.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/attr.c b/attr.c
index c33e4135c3..cac550decd 100644
--- a/attr.c
+++ b/attr.c
@@ -140,7 +140,7 @@ struct match_attr {
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;
@@ -167,7 +167,7 @@ static const char *parse_attr(const char *src, int lineno, const char *cp,
} 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++;
@@ -180,7 +180,6 @@ static const char *parse_attr(const char *src, int lineno, const char *cp,
}
e->attr = git_attr_internal(cp, len);
}
- (*num_attr)++;
return ep + strspn(ep, blank);
}
@@ -226,9 +225,10 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
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;