This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
locale.c: Rmv unnecessary locale toggle
authorKarl Williamson <khw@cpan.org>
Thu, 15 Feb 2018 04:40:24 +0000 (21:40 -0700)
committerKarl Williamson <khw@cpan.org>
Sun, 18 Feb 2018 18:20:32 +0000 (11:20 -0700)
I don't know why this code thought it needed to change to the C locale
for LC_CTYPE, in order to output a fully formed warning message, and
then to switch back.  So remove the toggles.

locale.c

index 4430f53..cca250b 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -747,20 +747,9 @@ S_new_ctype(pTHX_ const char *newctype)
              * they are immune to bad ones.  */
             if (IN_LC(LC_CTYPE) || UNLIKELY(DEBUG_L_TEST)) {
 
-                /* We have to save 'newctype' because the setlocale() just
-                 * below may destroy it.  The next setlocale() further down
-                 * should restore it properly so that the intermediate change
-                 * here is transparent to this function's caller */
-                const char * const badlocale = savepv(newctype);
-
-                do_setlocale_c(LC_CTYPE, "C");
-
                 /* The '0' below suppresses a bogus gcc compiler warning */
                 Perl_warner(aTHX_ packWARN(WARN_LOCALE), SvPVX(PL_warn_locale), 0);
 
-                do_setlocale_c(LC_CTYPE, badlocale);
-                Safefree(badlocale);
-
                 if (IN_LC(LC_CTYPE)) {
                     SvREFCNT_dec_NN(PL_warn_locale);
                     PL_warn_locale = NULL;