summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-01-22 01:21:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2023-01-22 01:21:58 (GMT)
commit60ce816cb637f8fac5e8e5b8a53dff8707b2c04c (patch)
tree54c95811c38748e928c7e788812844d85e8a059d /compat
parent90c47b3fbabd6ffecfd234911841892b562cfe9e (diff)
parent6e578410960d9ceb35ec98ad4b6fc711f1a9c85c (diff)
downloadgit-60ce816cb637f8fac5e8e5b8a53dff8707b2c04c.zip
git-60ce816cb637f8fac5e8e5b8a53dff8707b2c04c.tar.gz
git-60ce816cb637f8fac5e8e5b8a53dff8707b2c04c.tar.bz2
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.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index af397e6..e433740 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)