summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2016-08-13 15:38:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-08-14 02:49:30 (GMT)
commitddd0bfac7cfaabc7c0422ecee9604ede9c4841d1 (patch)
treef8add82ee82cd7f7101ee9a51924f1f9d6698f3e /builtin
parent0bb1519f05aed047a969b9fe0bfa80e6ef804c7f (diff)
downloadgit-ddd0bfac7cfaabc7c0422ecee9604ede9c4841d1.zip
git-ddd0bfac7cfaabc7c0422ecee9604ede9c4841d1.tar.gz
git-ddd0bfac7cfaabc7c0422ecee9604ede9c4841d1.tar.bz2
receive-pack: use FLEX_ALLOC_MEM in queue_command()
Use the macro FLEX_ALLOC_MEM instead of open-coding it. This shortens and simplifies the code a bit. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 c8e32b2..b55d0aa 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1372,11 +1372,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;
}