Add allocation and freeing functions for struct refs
Instead of open-coding allocation wherever it happens, have a function. Also, add a function to free a list of refs, which we currently never actually do. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
54dadbdb29
commit
dfd255dd1a
@ -72,7 +72,7 @@ struct ref **get_remote_heads(int in, struct ref **list,
|
||||
continue;
|
||||
if (nr_match && !path_match(name, nr_match, match))
|
||||
continue;
|
||||
ref = xcalloc(1, sizeof(*ref) + len - 40);
|
||||
ref = alloc_ref(len - 40);
|
||||
hashcpy(ref->old_sha1, old_sha1);
|
||||
memcpy(ref->name, buffer + 41, len - 40);
|
||||
*list = ref;
|
||||
|
||||
Reference in New Issue
Block a user