summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-09-08 21:36:00 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-09-08 21:36:00 -0700
commit9bef64223606a2c5fdc696745ce02b4af62bda90 (patch)
treecaaa4011d093adb2569ecaca4705d48b55ee9f66 /builtin
parentMerge branch 'rs/use-strbuf-add-unique-abbrev' into maint (diff)
parentreceive-pack: use FLEX_ALLOC_MEM in queue_command() (diff)
downloadtgif-9bef64223606a2c5fdc696745ce02b4af62bda90.tar.xz
Merge branch 'jk/tighten-alloc' into maint
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.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index a744437b58..05d04400f5 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1375,11 +1375,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;
}