summaryrefslogtreecommitdiff
path: root/locale.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-12-11 14:30:45 -0700
committerKarl Williamson <public@khwilliamson.com>2014-01-04 13:33:04 -0700
commit6959d69d33a0e59f62289d1c27a5c094387a6933 (patch)
tree8e45ba5740484940a0dc4db1064a80a48a5f30b5 /locale.c
parent87755cd9fa6144875541cb560b7f0487e52c8626 (diff)
downloadperl-6959d69d33a0e59f62289d1c27a5c094387a6933.tar.gz
locale.c: Always set state variables for a new locale
This function is called when a new underlying LC_NUMERIC locale has been set. If that locale is the same as the current underlying one, some setup is skipped. However, prior to this commit, more was skipped than should have been. The reason is that even if the underlying locale is the same, it could be that LC_NUMERIC has been toggled to the "C" locale, and so the information could be inconsistent. By always setting the information, we ensure consistency. This commit ia a portion of the fix for [perl #120723]. Tests will be added with the final commit for it.
Diffstat (limited to 'locale.c')
-rw-r--r--locale.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/locale.c b/locale.c
index 31aa592336..6f8e551320 100644
--- a/locale.c
+++ b/locale.c
@@ -134,15 +134,13 @@ Perl_new_numeric(pTHX_ const char *newnum)
if (! PL_numeric_name || strNE(PL_numeric_name, save_newnum)) {
Safefree(PL_numeric_name);
PL_numeric_name = save_newnum;
- PL_numeric_standard = ((*save_newnum == 'C' && save_newnum[1] == '\0')
- || strEQ(save_newnum, "POSIX"));
- PL_numeric_local = TRUE;
- set_numeric_radix();
- }
- else {
- Safefree(save_newnum);
}
+ PL_numeric_standard = ((*save_newnum == 'C' && save_newnum[1] == '\0')
+ || strEQ(save_newnum, "POSIX"));
+ PL_numeric_local = TRUE;
+ set_numeric_radix();
+
#endif /* USE_LOCALE_NUMERIC */
}