[PATCH v3 1/4] msvcrt: Make locale and thread helper functions CDECL.

Rémi Bernon rbernon at codeweavers.com
Mon Nov 9 08:53:46 CST 2020


This prevent callers from having to save AVX registers to the stack.

It is for instance the case in MSVCRT__towlower_l, which is called on
every character by MSVCRT__wcsicmp_l.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

v3: Don't try to be clever in MSVCRT__wcslwr_s_l / MSVCRT__wcsupr_s_l,
    just free the locale in the return 0 case.

 dlls/msvcrt/locale.c | 4 ++--
 dlls/msvcrt/msvcrt.h | 6 +++---
 dlls/msvcrt/thread.c | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index 7562f70eb0b..f25c1228d2f 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -452,7 +452,7 @@ static inline void swap_pointers(void **p1, void **p2) {
 }
 
 /* INTERNAL: returns pthreadlocinfo struct */
-MSVCRT_pthreadlocinfo get_locinfo(void) {
+MSVCRT_pthreadlocinfo CDECL get_locinfo(void) {
     thread_data_t *data = msvcrt_get_thread_data();
 
     if(!data || !data->have_locale)
@@ -462,7 +462,7 @@ MSVCRT_pthreadlocinfo get_locinfo(void) {
 }
 
 /* INTERNAL: returns pthreadlocinfo struct */
-MSVCRT_pthreadmbcinfo get_mbcinfo(void) {
+MSVCRT_pthreadmbcinfo CDECL get_mbcinfo(void) {
     thread_data_t *data = msvcrt_get_thread_data();
 
     if(!data || !data->have_locale)
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h
index 4f79778f7cc..f73117ae5e2 100644
--- a/dlls/msvcrt/msvcrt.h
+++ b/dlls/msvcrt/msvcrt.h
@@ -308,7 +308,7 @@ struct __thread_data {
 
 typedef struct __thread_data thread_data_t;
 
-extern thread_data_t *msvcrt_get_thread_data(void) DECLSPEC_HIDDEN;
+extern thread_data_t *CDECL msvcrt_get_thread_data(void) DECLSPEC_HIDDEN;
 
 LCID MSVCRT_locale_to_LCID(const char*, unsigned short*, BOOL*) DECLSPEC_HIDDEN;
 extern MSVCRT__locale_t MSVCRT_locale DECLSPEC_HIDDEN;
@@ -1128,8 +1128,8 @@ int            __cdecl MSVCRT__set_printf_count_output(int);
 #define MSVCRT__DISABLE_PER_THREAD_LOCALE 2
 
 extern MSVCRT__locale_t MSVCRT_locale;
-MSVCRT_pthreadlocinfo get_locinfo(void) DECLSPEC_HIDDEN;
-MSVCRT_pthreadmbcinfo get_mbcinfo(void) DECLSPEC_HIDDEN;
+MSVCRT_pthreadlocinfo CDECL get_locinfo(void) DECLSPEC_HIDDEN;
+MSVCRT_pthreadmbcinfo CDECL get_mbcinfo(void) DECLSPEC_HIDDEN;
 void __cdecl MSVCRT__free_locale(MSVCRT__locale_t);
 void free_locinfo(MSVCRT_pthreadlocinfo) DECLSPEC_HIDDEN;
 void free_mbcinfo(MSVCRT_pthreadmbcinfo) DECLSPEC_HIDDEN;
diff --git a/dlls/msvcrt/thread.c b/dlls/msvcrt/thread.c
index af31534adbd..11573892e95 100644
--- a/dlls/msvcrt/thread.c
+++ b/dlls/msvcrt/thread.c
@@ -35,7 +35,7 @@ typedef struct {
  *
  * Return the thread local storage structure.
  */
-thread_data_t *msvcrt_get_thread_data(void)
+thread_data_t *CDECL msvcrt_get_thread_data(void)
 {
     thread_data_t *ptr;
     DWORD err = GetLastError();  /* need to preserve last error */
-- 
2.29.2




More information about the wine-devel mailing list