зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
0bb1519f05
Коммит
ddd0bfac7c
|
@ -1372,11 +1372,9 @@ static struct command **queue_command(struct command **tail,
|
||||||
|
|
||||||
refname = line + 82;
|
refname = line + 82;
|
||||||
reflen = linelen - 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->old_sha1, old_sha1);
|
||||||
hashcpy(cmd->new_sha1, new_sha1);
|
hashcpy(cmd->new_sha1, new_sha1);
|
||||||
memcpy(cmd->ref_name, refname, reflen);
|
|
||||||
cmd->ref_name[reflen] = '\0';
|
|
||||||
*tail = cmd;
|
*tail = cmd;
|
||||||
return &cmd->next;
|
return &cmd->next;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче