This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Revert "Perl_sv_vcatpvfn_flags: skip IN_LC(LC_NUMERIC)"
authorDavid Mitchell <davem@iabyn.com>
Tue, 8 Aug 2017 08:53:13 +0000 (09:53 +0100)
committerDavid Mitchell <davem@iabyn.com>
Tue, 8 Aug 2017 08:53:13 +0000 (09:53 +0100)
This reverts commit c10a72e1914795f6399890aafae13734552645cd.

I thought that if PL_numeric_radix_sv is true, then IN_LC(LC_NUMERIC) must
be true, so no need to test for both. So I replaced the expensive
IN_LC(LC_NUMERIC) test with an assert.

But in http://nntp.perl.org/group/perl.perl5.porters/245455, Karl points
out that  the assert is triggering on HP-UX.

So there's something wrong with my logic something.

So revert.

sv.c

diff --git a/sv.c b/sv.c
index 087fc73..c370f97 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -11767,10 +11767,9 @@ S_format_hexfp(pTHX_ char * const buf, const STRLEN bufsize, const char c,
 #ifndef USE_LOCALE_NUMERIC
             *p++ = '.';
 #else
-            if (PL_numeric_radix_sv) {
+            if (PL_numeric_radix_sv && IN_LC(LC_NUMERIC)) {
                 STRLEN n;
                 const char* r = SvPV(PL_numeric_radix_sv, n);
-                assert(IN_LC(LC_NUMERIC));
                 Copy(r, p, n, char);
                 p += n;
             }
@@ -12963,8 +12962,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
                 lc_numeric_set = TRUE;
             }
 
-            if (PL_numeric_radix_sv) {
-                assert(IN_LC(LC_NUMERIC));
+            if (PL_numeric_radix_sv && IN_LC(LC_NUMERIC)) {
                 /* this can't wrap unless PL_numeric_radix_sv is a string
                  * consuming virtually all the 32-bit or 64-bit address
                  * space