aboutsummaryrefslogtreecommitdiff
path: root/remote-curl.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-09-24 17:08:09 -0400
committerJunio C Hamano <gitster@pobox.com>2015-10-05 11:08:05 -0700
commit6f687c21c07bfb83a63049640cba5fb82c174198 (patch)
tree676902427bac01c3d0a4b3e72d19f14421c72e25 /remote-curl.c
parentcbc8feeaf97db39ff7220c4d1b03e0c3fdd2401c (diff)
downloadgit-6f687c21c07bfb83a63049640cba5fb82c174198.tar.gz
git-6f687c21c07bfb83a63049640cba5fb82c174198.tar.xz
use alloc_ref rather than hand-allocating "struct ref"
This saves us some manual computation, and eliminates a call to strcpy. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote-curl.c')
-rw-r--r--remote-curl.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/remote-curl.c b/remote-curl.c
index 71fbbb694..cc7a8a66f 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -168,10 +168,7 @@ static struct ref *parse_info_refs(struct discovery *heads)
url.buf);
data[i] = 0;
ref_name = mid + 1;
- ref = xmalloc(sizeof(struct ref) +
- strlen(ref_name) + 1);
- memset(ref, 0, sizeof(struct ref));
- strcpy(ref->name, ref_name);
+ ref = alloc_ref(ref_name);
get_sha1_hex(start, ref->old_sha1);
if (!refs)
refs = ref;