summaryrefslogtreecommitdiff
path: root/attr.c
diff options
context:
space:
mode:
authorPierre Habouzit <madcoder@debian.org>2007-09-16 00:32:36 +0200
committerJunio C Hamano <gitster@pobox.com>2007-09-18 17:42:17 -0700
commit182af8343c307436bb5364309aa6d4d46fa5911d (patch)
tree154c50047e12595027a0d61f54bfdd6ecd2305a5 /attr.c
parent39bd2eb56af89d43a08ba54699d9a1849ab57b39 (diff)
downloadgit-182af8343c307436bb5364309aa6d4d46fa5911d.tar.gz
Use xmemdupz() in many places.
Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'attr.c')
-rw-r--r--attr.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/attr.c b/attr.c
index 129399310a..92704a3f61 100644
--- a/attr.c
+++ b/attr.c
@@ -160,12 +160,7 @@ static const char *parse_attr(const char *src, int lineno, const char *cp,
else if (!equals)
e->setto = ATTR__TRUE;
else {
- char *value;
- int vallen = ep - equals;
- value = xmalloc(vallen);
- memcpy(value, equals+1, vallen-1);
- value[vallen-1] = 0;
- e->setto = value;
+ e->setto = xmemdupz(equals + 1, ep - equals - 1);
}
e->attr = git_attr(cp, len);
}