From ee45e1e97ae69c66cd261dc8c4e2e4640238a34b Mon Sep 17 00:00:00 2001 From: ironhead <ironhead> Date: Mon, 27 Dec 2010 21:01:13 +0000 Subject: [PATCH] 2010-11-08 Rodrigo Rivas Costa <rodrigorivascosta@gmail.com> * tlssup.c (__dyn_tls_init): Use an integer variable to iterate between __xd_a and __xd_z. --- ChangeLog | 5 +++++ tlssup.c | 21 ++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index e90df7c..bc65b26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-11-08 Rodrigo Rivas Costa <rodrigorivascosta@gmail.com> + + * tlssup.c (__dyn_tls_init): Use an integer variable to iterate between + __xd_a and __xd_z. + 2010-07-25 Keith Marshall <keithmarshall@users.sourceforge.net> Accept that mingwrt headers are not guaranteed to precede GCC's in the diff --git a/tlssup.c b/tlssup.c index b101d11..660d098 100644 --- a/tlssup.c +++ b/tlssup.c @@ -94,6 +94,7 @@ BOOL WINAPI __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) { _PVFV *pfunc; + int nfuncs, ifunc; #ifndef _WIN64 if (_winmajor < 4) @@ -107,13 +108,13 @@ __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) } if (__mingw_mthread_hdll == NULL || !__mingw_gMTRemoveKeyDtor || !__mingw_gMTKeyDtor) { - __mingw_gMTKeyDtor = NULL; - __mingw_gMTRemoveKeyDtor = NULL; - if (__mingw_mthread_hdll) - FreeLibrary (__mingw_mthread_hdll); - __mingw_mthread_hdll = NULL; - _CRT_MT = 0; - return TRUE; + __mingw_gMTKeyDtor = NULL; + __mingw_gMTRemoveKeyDtor = NULL; + if (__mingw_mthread_hdll) + FreeLibrary (__mingw_mthread_hdll); + __mingw_mthread_hdll = NULL; + _CRT_MT = 0; + return TRUE; } _CRT_MT = 1; return TRUE; @@ -130,10 +131,12 @@ __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) return TRUE; } - for (pfunc = &__xd_a + 1; pfunc != &__xd_z; ++pfunc) + nfuncs = &__xd_z - (&__xd_a + 1); + for (ifunc = 0; ifunc < nfuncs; ++ifunc) { + pfunc = (&__xd_a + 1) + ifunc; if (*pfunc != NULL) - (*pfunc)(); + (*pfunc)(); } return TRUE; } -- 1.7.6