summaryrefslogtreecommitdiff
path: root/locale.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-07-07 14:38:08 -0600
committerKarl Williamson <khw@cpan.org>2014-07-09 08:04:53 -0600
commit28c1bf331d7ac09dee248e6e1f7e52c8ed677e6a (patch)
treef362e17b555fad4a8a66c8a3afbec1454c885c08 /locale.c
parent126aedc49bc9cee9fc4dc22101aeb9f422ca8cc2 (diff)
downloadperl-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.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/locale.c b/locale.c
index c305747b72..9388a252c4 100644
--- a/locale.c
+++ b/locale.c
@@ -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));