crt: gdtoa: Replace atexit by __attribute__((destructor)) This avoid overhead of atexit call which requires dynamic allocation and for DLL builds also larger code which is statically linked into every DLL. Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-crt/gdtoa/misc.c b/mingw-w64-crt/gdtoa/misc.c index 74a2ca6..960543a 100644 --- a/mingw-w64-crt/gdtoa/misc.c +++ b/mingw-w64-crt/gdtoa/misc.c
@@ -59,6 +59,8 @@ 2 = initialized 3 = deleted */ + +__attribute__((destructor)) static void dtoa_lock_cleanup (void) { long last_CS_init = InterlockedExchange (&dtoa_CS_init,3); @@ -80,7 +82,6 @@ int i; for (i = 0; i < NLOCKS; i++) InitializeCriticalSection (&dtoa_CritSec[i]); - atexit (dtoa_lock_cleanup); (void)InterlockedExchange (&dtoa_CS_init, 2); } }