Piotr Caban : msvcrt: Reimplement _configthreadlocale function.

Alexandre Julliard julliard at winehq.org
Wed Nov 25 15:58:55 CST 2020


Module: wine
Branch: master
Commit: a9dfe7aba20ab30743c838e378e2bfe02bb99a9d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a9dfe7aba20ab30743c838e378e2bfe02bb99a9d

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Nov 25 20:24:37 2020 +0100

msvcrt: Reimplement _configthreadlocale function.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/locale.c | 37 +++++++------------------------------
 1 file changed, 7 insertions(+), 30 deletions(-)

diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index 3925678a9fd..2502e556ee2 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -2128,40 +2128,17 @@ int CDECL _configthreadlocale(int type)
     thread_data_t *data = msvcrt_get_thread_data();
     int ret;
 
-    if(!data)
-        return -1;
-
     ret = (data->locale_flags & LOCALE_THREAD ? MSVCRT__ENABLE_PER_THREAD_LOCALE :
             MSVCRT__DISABLE_PER_THREAD_LOCALE);
-    if(ret == type)
-        return ret;
-
-    if(data->locale_flags & LOCALE_FREE)
-    {
-        free_locinfo(data->locinfo);
-        free_mbcinfo(data->mbcinfo);
-        data->locale_flags &= ~LOCALE_FREE;
-    }
-
-    if(type == MSVCRT__ENABLE_PER_THREAD_LOCALE) {
-        MSVCRT__locale_tstruct locale;
 
-        get_current_locale_noalloc(&locale);
-        data->locinfo = locale.locinfo;
-        data->mbcinfo = locale.mbcinfo;
-        data->locale_flags = LOCALE_FREE | LOCALE_THREAD;
-        return ret;
-    }
+    if(type == MSVCRT__ENABLE_PER_THREAD_LOCALE)
+        data->locale_flags |= LOCALE_THREAD;
+    else if(type == MSVCRT__DISABLE_PER_THREAD_LOCALE)
+        data->locale_flags &= ~LOCALE_THREAD;
+    else if(type)
+        ret = -1;
 
-    if(type == MSVCRT__DISABLE_PER_THREAD_LOCALE) {
-        data->locale_flags = 0;
-        return ret;
-    }
-
-    if(!type)
-        return ret;
-
-    return -1;
+    return ret;
 }
 #endif
 




More information about the wine-cvs mailing list