msvcrt: Add helper function that returns current locale.

This commit is contained in:
Piotr Caban 2010-04-15 14:25:34 +02:00 committed by Alexandre Julliard
parent d58b385b38
commit 59c2201a9c
3 changed files with 13 additions and 0 deletions

View File

@ -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.@)

View File

@ -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);
}

View File

@ -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