Commit 59c2201a authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Add helper function that returns current locale.

parent d58b385b
......@@ -317,6 +317,16 @@ static inline void swap_pointers(void **p1, void **p2) {
*p2 = hlp;
}
/* INTERNAL: returns _locale_t struct for current locale */
MSVCRT__locale_t get_locale(void) {
thread_data_t *data = msvcrt_get_thread_data();
if(!data || !data->locale)
return MSVCRT_locale;
return data->locale;
}
/*********************************************************************
* wsetlocale (MSVCRT.@)
......
......@@ -69,6 +69,7 @@ static inline void msvcrt_free_tls_mem(void)
HeapFree(GetProcessHeap(),0,tls->asctime_buffer);
HeapFree(GetProcessHeap(),0,tls->wasctime_buffer);
HeapFree(GetProcessHeap(),0,tls->strerror_buffer);
_free_locale(tls->locale);
}
HeapFree(GetProcessHeap(), 0, tls);
}
......
......@@ -115,6 +115,7 @@ struct __thread_data {
MSVCRT_unexpected_function unexpected_handler;
MSVCRT__se_translator_function se_translator;
EXCEPTION_RECORD *exc_record;
struct MSVCRT_localeinfo_struct *locale;
};
typedef struct __thread_data thread_data_t;
......@@ -791,6 +792,7 @@ typedef struct MSVCRT_localeinfo_struct
} MSVCRT__locale_tstruct, *MSVCRT__locale_t;
extern MSVCRT__locale_t MSVCRT_locale;
MSVCRT__locale_t get_locale(void);
void __cdecl _free_locale(MSVCRT__locale_t);
#ifndef __WINE_MSVCRT_TEST
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment