]> git.ipfire.org Git - thirdparty/git.git/blobdiff - remote.c
convert trivial cases to FLEX_ARRAY macros
[thirdparty/git.git] / remote.c
index 9d34b5a5dafa217e2ce9cb1b7e9a4ab74908f7af..7a8a8a1b4a907478cc490ecdeec7736bbdfc70f4 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -2132,16 +2132,13 @@ static int one_local_ref(const char *refname, const struct object_id *oid,
 {
        struct ref ***local_tail = cb_data;
        struct ref *ref;
-       int len;
 
        /* we already know it starts with refs/ to get here */
        if (check_refname_format(refname + 5, 0))
                return 0;
 
-       len = strlen(refname) + 1;
-       ref = xcalloc(1, sizeof(*ref) + len);
+       ref = alloc_ref(refname);
        oidcpy(&ref->new_oid, oid);
-       memcpy(ref->name, refname, len);
        **local_tail = ref;
        *local_tail = &ref->next;
        return 0;