summaryrefslogtreecommitdiff
path: root/run-command.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2017-10-01 15:14:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-10-02 23:42:57 (GMT)
commit0e187d758cd4ad0f929b90b04adee7ec19f7fc93 (patch)
tree7d4318ef7e4d6e6c67c1646edc9cf558183102a5 /run-command.c
parent4010f1d1b782eb7585e0e0abcefa794bd5ff29a0 (diff)
downloadgit-0e187d758cd4ad0f929b90b04adee7ec19f7fc93.zip
git-0e187d758cd4ad0f929b90b04adee7ec19f7fc93.tar.gz
git-0e187d758cd4ad0f929b90b04adee7ec19f7fc93.tar.bz2
run-command: use ALLOC_ARRAY
Use the macro ALLOC_ARRAY to allocate an array. This is shorter and easier, as it automatically infers the size of elements. Patch generated with Coccinelle and contrib/coccinelle/array.cocci. Signeg-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'run-command.c')
-rw-r--r--run-command.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/run-command.c b/run-command.c
index b5e6eb3..014b216 100644
--- a/run-command.c
+++ b/run-command.c
@@ -452,7 +452,7 @@ static char **prep_childenv(const char *const *deltaenv)
}
/* Create an array of 'char *' to be used as the childenv */
- childenv = xmalloc((env.nr + 1) * sizeof(char *));
+ ALLOC_ARRAY(childenv, env.nr + 1);
for (i = 0; i < env.nr; i++)
childenv[i] = env.items[i].util;
childenv[env.nr] = NULL;