diff options
author | Karl Williamson <khw@cpan.org> | 2014-07-07 14:38:08 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2014-07-09 08:04:53 -0600 |
commit | 28c1bf331d7ac09dee248e6e1f7e52c8ed677e6a (patch) | |
tree | f362e17b555fad4a8a66c8a3afbec1454c885c08 /locale.c | |
parent | 126aedc49bc9cee9fc4dc22101aeb9f422ca8cc2 (diff) | |
download | perl-28c1bf331d7ac09dee248e6e1f7e52c8ed677e6a.tar.gz |
locale.c: Remove conditionals.
These two functions are supposed to normally be called through macro
interfaces which check whether they actually should be called or not.
That means the conditionals removed by this commit are redundant from
the normal interface. By removing them, we allow the exceptional case
where the code should be executed unconditionally, to happen, by just
calling the functions directly, not using the macro interface.
Diffstat (limited to 'locale.c')
-rw-r--r-- | locale.c | 21 |
1 files changed, 10 insertions, 11 deletions
@@ -211,16 +211,16 @@ void Perl_set_numeric_standard(pTHX) { #ifdef USE_LOCALE_NUMERIC - /* Toggle the LC_NUMERIC locale to C, if not already there. Probably - * should use the macros like SET_NUMERIC_STANDARD() in perl.h instead of - * calling this directly. */ + /* Toggle the LC_NUMERIC locale to C. Most code should use the macros like + * SET_NUMERIC_STANDARD() in perl.h instead of calling this directly. The + * macro avoids calling this routine if toggling isn't necessary according + * to our records (which could be wrong if some XS code has changed the + * locale behind our back) */ - if (_NOT_IN_NUMERIC_STANDARD) { setlocale(LC_NUMERIC, "C"); PL_numeric_standard = TRUE; PL_numeric_local = isNAME_C_OR_POSIX(PL_numeric_name); set_numeric_radix(); - } DEBUG_L(PerlIO_printf(Perl_debug_log, "Underlying LC_NUMERIC locale now is C\n")); @@ -231,16 +231,15 @@ void Perl_set_numeric_local(pTHX) { #ifdef USE_LOCALE_NUMERIC - /* Toggle the LC_NUMERIC locale to the current underlying default, if not - * already there. Probably should use the macros like SET_NUMERIC_LOCAL() - * in perl.h instead of calling this directly. */ - - if (_NOT_IN_NUMERIC_LOCAL) { + /* Toggle the LC_NUMERIC locale to the current underlying default. Most + * code should use the macros like SET_NUMERIC_LOCAL() in perl.h instead of + * calling this directly. The macro avoids calling this routine if + * toggling isn't necessary according to our records (which could be wrong + * if some XS code has changed the locale behind our back) */ setlocale(LC_NUMERIC, PL_numeric_name); PL_numeric_standard = isNAME_C_OR_POSIX(PL_numeric_name); PL_numeric_local = TRUE; set_numeric_radix(); - } DEBUG_L(PerlIO_printf(Perl_debug_log, "Underlying LC_NUMERIC locale now is %s\n", PL_numeric_name)); |