mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
cbc8feeaf9
commit
6f687c21c0
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user