Skip to content

Meld Windows and non-Windows setlocale(..., "") into a single function, and tidy #20370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Oct 10, 2022
Merged
18 changes: 13 additions & 5 deletions embed.fnc
Original file line number Diff line number Diff line change
Expand Up @@ -3381,7 +3381,6 @@ S |const char *|setlocale_from_aggregate_LC_ALL \
S |const char*|update_PL_curlocales_i|const unsigned int index \
|NN const char * new_locale \
|recalc_lc_all_t recalc_LC_ALL
S |const char *|find_locale_from_environment|const unsigned int index
# endif
# else
# if defined(USE_LOCALE_THREADS) \
Expand All @@ -3402,11 +3401,15 @@ S |void |less_dicey_void_setlocale_i \
|const line_t line
# endif
# endif
# if defined(WIN32) || ( defined(USE_POSIX_2008_LOCALE) \
&& ! defined(USE_QUERYLOCALE))
S |const char *|find_locale_from_environment|const unsigned int index
# endif
# if defined(USE_POSIX_2008_LOCALE) && defined(USE_QUERYLOCALE)
S |const char *|calculate_LC_ALL|const locale_t cur_obj
# else
: regen/embed.pl can't currently cope with 'elif'
# if defined(USE_POSIX_2008_LOCALE) || ! defined(LC_ALL)
# if defined(WIN32) || defined(USE_POSIX_2008_LOCALE) || ! defined(LC_ALL)
S |const char *|calculate_LC_ALL|NN const char ** individ_locales
# endif
# endif
Expand All @@ -3422,9 +3425,14 @@ S |void |print_collxfrm_input_and_return \
# endif
# endif
# ifdef WIN32
S |char* |win32_setlocale|int category|NULLOK const char* locale
pTC |wchar_t *|Win_utf8_string_to_wstring|NULLOK const char * utf8_string
pTC |char * |Win_wstring_to_utf8_string|NULLOK const wchar_t * wstring
S |const char*|win32_setlocale|int category|NULLOK const char* locale
ST |wchar_t *|Win_byte_string_to_wstring|const UINT code_page \
|NULLOK const char * byte_string
ST |char * |Win_wstring_to_byte_string|const UINT code_page \
|NULLOK const wchar_t * wstring
S |const char *|wrap_wsetlocale \
|const int category \
|NULLOK const char *locale
# endif
# if defined(HAS_NL_LANGINFO) || defined(HAS_NL_LANGINFO_L)
S |const char*|my_langinfo_i|const nl_item item \
Expand Down
17 changes: 7 additions & 10 deletions embed.h
Original file line number Diff line number Diff line change
Expand Up @@ -826,14 +826,6 @@
#define dump_mstats(a) Perl_dump_mstats(aTHX_ a)
#define get_mstats(a,b,c) Perl_get_mstats(aTHX_ a,b,c)
#endif
#if defined(PERL_IN_LOCALE_C)
# if defined(USE_LOCALE)
# if defined(WIN32)
#define Win_utf8_string_to_wstring Perl_Win_utf8_string_to_wstring
#define Win_wstring_to_utf8_string Perl_Win_wstring_to_utf8_string
# endif
# endif
#endif
#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C)
#define check_regnode_after(a,b) Perl_check_regnode_after(aTHX_ a,b)
#define regnext(a) Perl_regnext(aTHX_ a)
Expand Down Expand Up @@ -1522,7 +1514,7 @@
# if !(defined(USE_POSIX_2008_LOCALE) && defined(USE_QUERYLOCALE))
# if defined(PERL_IN_LOCALE_C)
# if defined(USE_LOCALE)
# if defined(USE_POSIX_2008_LOCALE) || ! defined(LC_ALL)
# if defined(WIN32) || defined(USE_POSIX_2008_LOCALE) || ! defined(LC_ALL)
#define calculate_LC_ALL(a) S_calculate_LC_ALL(aTHX_ a)
# endif
# endif
Expand Down Expand Up @@ -1598,7 +1590,6 @@
# if defined(PERL_IN_LOCALE_C)
# if defined(USE_LOCALE)
# if defined(USE_POSIX_2008_LOCALE)
#define find_locale_from_environment(a) S_find_locale_from_environment(aTHX_ a)
#define update_PL_curlocales_i(a,b,c) S_update_PL_curlocales_i(aTHX_ a,b,c)
# endif
# endif
Expand Down Expand Up @@ -1781,7 +1772,13 @@
#define calculate_LC_ALL(a) S_calculate_LC_ALL(aTHX_ a)
# endif
# if defined(WIN32)
#define Win_byte_string_to_wstring S_Win_byte_string_to_wstring
#define Win_wstring_to_byte_string S_Win_wstring_to_byte_string
#define win32_setlocale(a,b) S_win32_setlocale(aTHX_ a,b)
#define wrap_wsetlocale(a,b) S_wrap_wsetlocale(aTHX_ a,b)
# endif
# if defined(WIN32) || ( defined(USE_POSIX_2008_LOCALE) && ! defined(USE_QUERYLOCALE))
#define find_locale_from_environment(a) S_find_locale_from_environment(aTHX_ a)
# endif
# endif
# endif
Expand Down
Loading