summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-12-16 22:34:19 -0700
committerKarl Williamson <public@khwilliamson.com>2014-01-04 13:33:05 -0700
commita2287a13f4e99299ebd9c06f9f98e1bdc7f5089e (patch)
tree5eb6aa123ff733760028e7a630db5fee6fb8b2bb /numeric.c
parent8a11fac97cbf1b0668b5ba645f1fb2709d10f82a (diff)
downloadperl-a2287a13f4e99299ebd9c06f9f98e1bdc7f5089e.tar.gz
Use new macros to make sure LC_NUMERIC is correctly set
This uses the macros added in the previous commit to make sure the current LC_NUMERIC locale is correct during the operation being done; restoring it to its prior condition afterwards. Outside of 'use locale' the locale should be C; inside it should be the underlying default locale. The macros handle the whole thing. In most of the places here, the code was trying to do what the macros do more elegantly, but there are some additional places where we set the locale correctly around an operation that is affected by it.
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/numeric.c b/numeric.c
index b5144f45b0..d8e85d99ff 100644
--- a/numeric.c
+++ b/numeric.c
@@ -853,6 +853,8 @@ Perl_my_atof(pTHX_ const char* s)
PERL_ARGS_ASSERT_MY_ATOF;
+ {
+ DECLARE_STORE_LC_NUMERIC_SET_TO_NEEDED();
if (PL_numeric_local && PL_numeric_radix_sv && IN_SOME_LOCALE_FORM) {
const char *standard = NULL, *local = NULL;
bool use_standard_radix;
@@ -878,6 +880,8 @@ Perl_my_atof(pTHX_ const char* s)
}
else
Perl_atof2(s, x);
+ RESTORE_LC_NUMERIC();
+ }
#else
Perl_atof2(s, x);
#endif