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 /t/t4252/file-2-0 | |
parent | Win32: factor out environment block creation (diff) | |
download | tgif-77734da241f97607eea8f2bb55e0e19937e918d4.tar.xz |
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 't/t4252/file-2-0')
0 files changed, 0 insertions, 0 deletions