crt: Localize usage of startinfo variable Variable startinfo is used only by __(w)getmainargs() call passed by the pointer in pre_cpp_init() function. The __(w)getmainargs() function does not use or store the pointer value, so the variable does not have to be static. Declare this variable just on the pre_cpp_init() function stack. The _startupinfo struct is an input-only struct with one member (int newmode). Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/crt/crtexe.c b/mingw-w64-crt/crt/crtexe.c index 88e9217..ef8f043 100644 --- a/mingw-w64-crt/crt/crtexe.c +++ b/mingw-w64-crt/crt/crtexe.c
@@ -62,7 +62,6 @@ static int mainret=0; static int managedapp; static int has_cctor = 0; -static _startupinfo startinfo; extern LPTOP_LEVEL_EXCEPTION_FILTER __mingw_oldexcpt_handler; extern void _pei386_runtime_relocator (void); @@ -125,6 +124,8 @@ static void __cdecl pre_cpp_init (void) { + _startupinfo startinfo; + startinfo.newmode = _newmode; #ifdef _UNICODE