This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
locale.c: Don't use special locale collation for C locale
authorKarl Williamson <khw@cpan.org>
Mon, 16 May 2016 21:15:26 +0000 (15:15 -0600)
committerKarl Williamson <khw@cpan.org>
Tue, 24 May 2016 16:26:28 +0000 (10:26 -0600)
We can skip all the locale collation calculations if the locale we are
in is C or POSIX.

locale.c

index 0bf8057..918c1d9 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -482,6 +482,7 @@ Perl_new_collate(pTHX_ const char *newcoll)
            PL_collation_name = NULL;
        }
        PL_collation_standard = TRUE;
+      is_standard_collation:
        PL_collxfrm_base = 0;
        PL_collxfrm_mult = 2;
        return;
@@ -493,6 +494,9 @@ Perl_new_collate(pTHX_ const char *newcoll)
        Safefree(PL_collation_name);
        PL_collation_name = stdize_locale(savepv(newcoll));
        PL_collation_standard = isNAME_C_OR_POSIX(newcoll);
+        if (PL_collation_standard) {
+            goto is_standard_collation;
+        }
 
        {
             /* A locale collation definition includes primary, secondary,