diff options
author | Karl Williamson <public@khwilliamson.com> | 2013-06-27 14:25:43 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2013-07-05 22:29:59 -0600 |
commit | b03f34cfd0bd2bbf204c9c669cd107351c03e4e3 (patch) | |
tree | ddba410257a58bb60c3335588aef2346346d677c /locale.c | |
parent | b3e384bf4606fb924aded7c2fa2cdf2d008c6ffb (diff) | |
download | perl-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.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -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 */ } |