1
0
mirror of https://github.com/git/git.git synced 2024-10-21 03:28:41 +02:00
git/compat
Karsten Blees 6f1c189cad Win32: use low-level memory allocation during initialization
As of d41489a6 "Add more large blob test cases", git's high-level memory
allocation functions (xmalloc, xmemdupz etc.) access the environment to
simulate limited memory in tests (see 'getenv("GIT_ALLOC_LIMIT")' in
memory_limit_check()). These functions should not be used before the
environment is fully initialized (particularly not to initialize the
environment itself).

The current solution ('environ = NULL; ALLOC_GROW(environ...)') only works
because MSVCRT's getenv() reinitializes environ when it is NULL (i.e. it
leaves us with two sets of unusabe (non-UTF-8) and unfreeable (CRT-
allocated) environments).

Add our own set of malloc-or-die functions to be used in startup code.

Also check the result of __wgetmainargs, which may fail if there's not
enough memory for wide-char arguments and environment.

This patch is in preparation of the sorted environment feature, which
completely replaces MSVCRT's getenv() implementation.

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>
2014-07-21 09:32:50 -07:00
..
nedmalloc
poll compat/poll: sleep 1 millisecond to avoid busy wait 2014-04-29 09:55:38 -07:00
regex
vcbuild Merge branch 'ks/tree-diff-nway' 2014-06-03 12:06:40 -07:00
win32 Win32: Unicode file name support (dirent) 2014-07-15 11:19:09 -07:00
apple-common-crypto.h
basename.c
bswap.h compat/bswap.h: fix endianness detection 2014-05-30 11:48:28 -07:00
fopen.c
gmtime.c date: recognize bogus FreeBSD gmtime output 2014-04-01 14:39:04 -07:00
hstrerror.c
inet_ntop.c
inet_pton.c
memmem.c
mingw.c Win32: use low-level memory allocation during initialization 2014-07-21 09:32:50 -07:00
mingw.h Win32: don't copy the environment twice when spawning child processes 2014-07-21 09:32:49 -07:00
mkdir.c
mkdtemp.c
mmap.c wrapper.c: add xpread() similar to xread() 2014-04-10 12:18:55 -07:00
msvc.c
msvc.h
obstack.c
obstack.h
pread.c
precompose_utf8.c
precompose_utf8.h
qsort.c
setenv.c
snprintf.c
strcasestr.c
strlcpy.c
strtoimax.c
strtoumax.c
terminal.c
terminal.h
unsetenv.c
win32.h
win32mmap.c
winansi.c Win32: reliably detect console pipe handles 2014-06-16 10:56:19 -07:00