Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2019-11-13 00:41:14 +0300
committerJunio C Hamano <gitster@pobox.com>2019-11-13 05:29:22 +0300
commit51bd6be32dfcb638727d89816a69ef13717ab17c (patch)
treef8a499f53044a3a6f73fc422f6b2cc9af1454a87 /compat/mingw.c
parent5fa0f5238b0cd46cfe7f6fa76c3f526ea98148d9 (diff)
mingw: use COPY_ARRAY for copying array
Use the macro COPY_ARRAY to copy array elements. The result is shorter and safer, as it infers the element type automatically and does a (very) basic type compatibility check for its first two arguments. Coccinelle and contrib/coccinelle/array.cocci did not generate this conversion due to the offset of 1 at both source and destination and because the source is a const pointer; the semantic patch cautiously handles only pure pointers and array references of the same type. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 738f0a826a..850b0ee93b 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1562,7 +1562,7 @@ static int try_shell_exec(const char *cmd, char *const *argv)
while (argv[argc]) argc++;
ALLOC_ARRAY(argv2, argc + 1);
argv2[0] = (char *)cmd; /* full path to the script file */
- memcpy(&argv2[1], &argv[1], sizeof(*argv) * argc);
+ COPY_ARRAY(&argv2[1], &argv[1], argc);
exec_id = trace2_exec(prog, argv2);
pid = mingw_spawnv(prog, argv2, 1);
if (pid >= 0) {