diff options
author | Karsten Blees <blees@dcon.de> | 2014-07-17 17:38:01 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-07-21 09:32:49 -0700 |
commit | 77734da241f97607eea8f2bb55e0e19937e918d4 (patch) | |
tree | 9df58d07e94ea309e2ef3f6043b3ec714d4d35ce /compat/mingw.h | |
parent | df0e998c31a6d91b905b1ad5b3ff89435ba29313 (diff) | |
download | git-77734da241f97607eea8f2bb55e0e19937e918d4.tar.gz |
Win32: don't copy the environment twice when spawning child processes
When spawning child processes via start_command(), the environment and all
environment entries are copied twice. First by make_augmented_environ /
copy_environ to merge with child_process.env. Then a second time by
make_environment_block to create a sorted environment block string as
required by CreateProcess.
Move the merge logic to make_environment_block so that we only need to copy
the environment once. This changes semantics of the env parameter: it now
expects a delta (such as child_process.env) rather than a full environment.
This is not a problem as the parameter is only used by start_command()
(all other callers previously passed char **environ, and now pass NULL).
The merge logic no longer xstrdup()s the environment strings, so do_putenv
must not free them. Add a parameter to distinguish this from normal putenv.
Remove the now unused make_augmented_environ / free_environ API.
Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/mingw.h')
-rw-r--r-- | compat/mingw.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/compat/mingw.h b/compat/mingw.h index 828d97760c..3851857c2d 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -357,12 +357,8 @@ int mingw_offset_1st_component(const char *path); void mingw_open_html(const char *path); #define open_html mingw_open_html -/* - * helpers - */ - -char **make_augmented_environ(const char *const *vars); -void free_environ(char **env); +void mingw_mark_as_git_dir(const char *dir); +#define mark_as_git_dir mingw_mark_as_git_dir /** * Converts UTF-8 encoded string to UTF-16LE. |