diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-01-22 02:21:58 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-01-22 02:21:58 +0100 |
commit | 60ce816cb637f8fac5e8e5b8a53dff8707b2c04c (patch) | |
tree | 54c95811c38748e928c7e788812844d85e8a059d /compat | |
parent | Merge branch 'jx/t1301-updates' (diff) | |
parent | use DUP_ARRAY (diff) | |
download | git-60ce816cb637f8fac5e8e5b8a53dff8707b2c04c.tar.xz git-60ce816cb637f8fac5e8e5b8a53dff8707b2c04c.zip |
Merge branch 'rs/dup-array'
Code cleaning.
* rs/dup-array:
use DUP_ARRAY
add DUP_ARRAY
do full type check in BARF_UNLESS_COPYABLE
factor out BARF_UNLESS_COPYABLE
mingw: make argv2 in try_shell_exec() non-const
Diffstat (limited to 'compat')
-rw-r--r-- | compat/mingw.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/compat/mingw.c b/compat/mingw.c index af397e68a1..e433740381 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1396,8 +1396,7 @@ static wchar_t *make_environment_block(char **deltaenv) p += s; } - ALLOC_ARRAY(result, size); - COPY_ARRAY(result, wenv, size); + DUP_ARRAY(result, wenv, size); FreeEnvironmentStringsW(wenv); return result; } @@ -1839,16 +1838,13 @@ static int try_shell_exec(const char *cmd, char *const *argv) if (prog) { int exec_id; int argc = 0; -#ifndef _MSC_VER - const -#endif char **argv2; while (argv[argc]) argc++; ALLOC_ARRAY(argv2, argc + 1); argv2[0] = (char *)cmd; /* full path to the script file */ COPY_ARRAY(&argv2[1], &argv[1], argc); - exec_id = trace2_exec(prog, argv2); - pid = mingw_spawnv(prog, argv2, 1); + exec_id = trace2_exec(prog, (const char **)argv2); + pid = mingw_spawnv(prog, (const char **)argv2, 1); if (pid >= 0) { int status; if (waitpid(pid, &status, 0) < 0) |