diff options
author | Jeff King <peff@peff.net> | 2014-06-19 17:19:43 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-06-19 15:20:53 -0700 |
commit | 95244ae3dd49b3eed4dbfe09299b9d8847622218 (patch) | |
tree | b70932b2e4e8205c2f6f6b0cfcb88ca172c2d9d9 /builtin/receive-pack.c | |
parent | fa3f60b783b42e0d07c667a8f582c3df12791cec (diff) | |
download | git-95244ae3dd49b3eed4dbfe09299b9d8847622218.tar.gz |
use xstrdup instead of xmalloc + strcpy
This is one line shorter, and makes sure the length in the
malloc and copy steps match.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/receive-pack.c')
-rw-r--r-- | builtin/receive-pack.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index c3230817db..18458e81c6 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -614,12 +614,9 @@ static void run_update_post_hook(struct command *commands) argv[0] = hook; for (argc = 1, cmd = commands; cmd; cmd = cmd->next) { - char *p; if (cmd->error_string || cmd->did_not_exist) continue; - p = xmalloc(strlen(cmd->ref_name) + 1); - strcpy(p, cmd->ref_name); - argv[argc] = p; + argv[argc] = xstrdup(cmd->ref_name); argc++; } argv[argc] = NULL; |