diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-08-17 14:07:46 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-08-17 14:07:46 -0700 |
commit | 2f664566c56db3ddbf12033c2b8f8091b693dc79 (patch) | |
tree | c886a3815c3c71e5c25042e55ab151e67ee3348f /builtin | |
parent | Merge branch 'va/i18n' (diff) | |
parent | receive-pack: use FLEX_ALLOC_MEM in queue_command() (diff) | |
download | tgif-2f664566c56db3ddbf12033c2b8f8091b693dc79.tar.xz |
Merge branch 'jk/tighten-alloc'
Small code and comment clean-up.
* jk/tighten-alloc:
receive-pack: use FLEX_ALLOC_MEM in queue_command()
correct FLEXPTR_* example in comment
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/receive-pack.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 92e1213ecc..011db00d31 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -1478,11 +1478,9 @@ static struct command **queue_command(struct command **tail, refname = line + 82; reflen = linelen - 82; - cmd = xcalloc(1, st_add3(sizeof(struct command), reflen, 1)); + FLEX_ALLOC_MEM(cmd, ref_name, refname, reflen); hashcpy(cmd->old_sha1, old_sha1); hashcpy(cmd->new_sha1, new_sha1); - memcpy(cmd->ref_name, refname, reflen); - cmd->ref_name[reflen] = '\0'; *tail = cmd; return &cmd->next; } |