summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-12-11 23:04:40 -0700
committerKarl Williamson <public@khwilliamson.com>2014-01-04 13:33:05 -0700
commit371d5d44b054ca1540da57f7be95194f1d92f449 (patch)
treebe1fd55dd560697b9e8f56965076e81daedd13f6 /perl.h
parenta2287a13f4e99299ebd9c06f9f98e1bdc7f5089e (diff)
downloadperl-371d5d44b054ca1540da57f7be95194f1d92f449.tar.gz
POSIX:strtod() should restore the locale it changed
Prior to this commit, the locale remained as strtod() set it to. I could not find a case where this actually was a problem, as the other code is good about checking for and changing the locale where needed. But uses of atoi(), strtol() in locales where there are spaces in numbers likely would break.
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/perl.h b/perl.h
index c777b1bb3c..b6e0c3eb28 100644
--- a/perl.h
+++ b/perl.h
@@ -5288,6 +5288,12 @@ typedef struct am_table_short AMTS;
bool was_standard = PL_numeric_standard && IN_SOME_LOCALE_FORM; \
if (was_standard) SET_NUMERIC_LOCAL();
+/* Rarely, we want to change to the underlying locale even outside of 'use
+ * locale'. This is principally in the POSIX:: functions */
+#define STORE_NUMERIC_STANDARD_FORCE_LOCAL() \
+ bool was_standard = PL_numeric_standard; \
+ if (was_standard) SET_NUMERIC_LOCAL();
+
#define RESTORE_NUMERIC_LOCAL() \
if (was_local) SET_NUMERIC_LOCAL();