Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
run-command: use ALLOC_ARRAY
author
René Scharfe
<l.s.r@web.de>
Sun, 1 Oct 2017 15:14:31 +0000
(17:14 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 2 Oct 2017 23:42:57 +0000
(08:42 +0900)
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>
run-command.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
4010f1d
)
diff --git
a/run-command.c
b/run-command.c
index b5e6eb37c0eb3d6ed0cbd4fc35e879bf9fbd3db6..014b2165b5a2f92ff18869effafd4c6df01b33eb 100644
(file)
--- 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;