This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
locale.c: Prepare for rearrangement of code blocks
authorKarl Williamson <khw@cpan.org>
Wed, 9 Jul 2014 19:22:17 +0000 (13:22 -0600)
committerKarl Williamson <khw@cpan.org>
Sat, 12 Jul 2014 14:41:13 +0000 (08:41 -0600)
This section of code just returned generally,.  This commit changes it
so that it drops off the end if it can't determine if the current locale
is UTF-8 or not, so that additional tests can be added later.  The
function defaults to not UTF-8 if this drops off the end, so there
should be no functionality change

locale.c

index 91e5095..0b1823a 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -1285,6 +1285,10 @@ Perl__is_cur_LC_category_utf8(pTHX_ int category)
             Safefree(save_monetary_locale);
         }
 
+        if (only_ascii) {
+            goto cant_use_monetary;
+        }
+
         Safefree(save_input_locale);
 
         /* It isn't a UTF-8 locale if the symbol is not legal UTF-8; otherwise
@@ -1292,13 +1296,8 @@ Perl__is_cur_LC_category_utf8(pTHX_ int category)
          * UTF-8.  (We can't really tell if the locale is UTF-8 or not if the
          * symbol is just a '$', so we err on the side of it not being UTF-8)
          * */
-        DEBUG_L(PerlIO_printf(Perl_debug_log, "\tis_utf8=%d\n", (illegal_utf8)
-                                                               ? FALSE
-                                                               : ! only_ascii));
-        return (illegal_utf8)
-                ? FALSE
-                : ! only_ascii;
-
+        DEBUG_L(PerlIO_printf(Perl_debug_log, "\tis_utf8=%d\n", ! illegal_utf8));
+        return ! illegal_utf8;
     }
   cant_use_monetary: