summaryrefslogtreecommitdiff
path: root/walker.c
diff options
context:
space:
mode:
authorKrzysztof Kowalczyk <kkowalczyk@gmail.com>2008-05-10 23:26:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-05-11 16:04:37 (GMT)
commit737922aa648c43bc6a61170bee5bfd46ff953f32 (patch)
treeebcdb2c587f0a5b781f0613a711f5501d6b89860 /walker.c
parent1f8115b113def8ee03701aa87b26c5e8b7c94434 (diff)
downloadgit-737922aa648c43bc6a61170bee5bfd46ff953f32.zip
git-737922aa648c43bc6a61170bee5bfd46ff953f32.tar.gz
git-737922aa648c43bc6a61170bee5bfd46ff953f32.tar.bz2
alloc_ref_from_str(): factor out a common pattern of alloc_ref from string
Also fix an underallocation in walker.c::interpret_target(). Signed-off-by: Krzysztof Kowalczyk <kkowalczyk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'walker.c')
-rw-r--r--walker.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/walker.c b/walker.c
index fa96a7c..31de6c1 100644
--- a/walker.c
+++ b/walker.c
@@ -190,8 +190,7 @@ static int interpret_target(struct walker *walker, char *target, unsigned char *
if (!get_sha1_hex(target, sha1))
return 0;
if (!check_ref_format(target)) {
- struct ref *ref = alloc_ref(strlen(target));
- strcpy(ref->name, target);
+ struct ref *ref = alloc_ref_from_str(target);
if (!walker->fetch_ref(walker, ref)) {
hashcpy(sha1, ref->old_sha1);
free(ref);