summaryrefslogtreecommitdiff
path: root/locale.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-06-27 14:25:43 -0600
committerKarl Williamson <public@khwilliamson.com>2013-07-05 22:29:59 -0600
commitb03f34cfd0bd2bbf204c9c669cd107351c03e4e3 (patch)
treeddba410257a58bb60c3335588aef2346346d677c /locale.c
parentb3e384bf4606fb924aded7c2fa2cdf2d008c6ffb (diff)
downloadperl-b03f34cfd0bd2bbf204c9c669cd107351c03e4e3.tar.gz
locale.c: Compare apples to apples
Prior to this patch, one parameter to strNE would have been through a standardizing function, while the other had not. By standardizing both before doing the compare, we avoid false positives.
Diffstat (limited to 'locale.c')
-rw-r--r--locale.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/locale.c b/locale.c
index bb0baf5f18..a73a8646ba 100644
--- a/locale.c
+++ b/locale.c
@@ -111,6 +111,7 @@ void
Perl_new_numeric(pTHX_ const char *newnum)
{
#ifdef USE_LOCALE_NUMERIC
+ char *save_newnum;
dVAR;
if (! newnum) {
@@ -121,14 +122,18 @@ Perl_new_numeric(pTHX_ const char *newnum)
return;
}
- if (! PL_numeric_name || strNE(PL_numeric_name, newnum)) {
+ save_newnum = stdize_locale(savepv(newnum));
+ if (! PL_numeric_name || strNE(PL_numeric_name, save_newnum)) {
Safefree(PL_numeric_name);
- PL_numeric_name = stdize_locale(savepv(newnum));
- PL_numeric_standard = ((*newnum == 'C' && newnum[1] == '\0')
- || strEQ(newnum, "POSIX"));
+ 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);
+ }
#endif /* USE_LOCALE_NUMERIC */
}