This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Rmv remaining uses of PL_Posix_ptrs
authorKarl Williamson <public@khwilliamson.com>
Mon, 6 Jan 2014 18:41:53 +0000 (11:41 -0700)
committerKarl Williamson <public@khwilliamson.com>
Thu, 9 Jan 2014 21:05:44 +0000 (14:05 -0700)
Previous commits have removed all but a few uses of PL_Posix_ptrs.  This
removes the rest.  ASCII is the same whether over all code points, or
just the ASCII range, so we can substitute the version for all code
points.  There is an extra intersection introduced by this commit during
the construction of a synthetic start class under /a and /aa, but the
performance hit should be negligible.

regcomp.c

index e9b35a6..9781bfa 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -4150,7 +4150,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp,
                      * range can participate */
                     if (OP(scan) == EXACTFA) {
                         _invlist_union_complement_2nd(EXACTF_invlist,
-                                                      PL_Posix_ptrs[_CC_ASCII],
+                                                      PL_XPosix_ptrs[_CC_ASCII],
                                                       &EXACTF_invlist);
                     }
                     else {
@@ -4706,7 +4706,14 @@ PerlIO_printf(Perl_debug_log, "LHS=%"UVdf" RHS=%"UVdf"\n",
                     /* FALL THROUGH */
                case POSIXA:
                     classnum = FLAGS(scan);
-                    my_invlist = PL_Posix_ptrs[classnum];
+                    if (classnum == _CC_ASCII) {
+                        my_invlist = PL_XPosix_ptrs[_CC_ASCII];
+                    }
+                    else {
+                        _invlist_intersection(PL_XPosix_ptrs[classnum],
+                                              PL_XPosix_ptrs[_CC_ASCII],
+                                              &my_invlist);
+                    }
                     goto join_posix;
 
                case NPOSIXD:
@@ -4723,7 +4730,7 @@ PerlIO_printf(Perl_debug_log, "LHS=%"UVdf" RHS=%"UVdf"\n",
                      * unknowable until match time */
                     if (PL_regkind[OP(scan)] == NPOSIXD) {
                         _invlist_union_complement_2nd(my_invlist,
-                                        PL_Posix_ptrs[_CC_ASCII], &my_invlist);
+                                        PL_XPosix_ptrs[_CC_ASCII], &my_invlist);
                     }
 
                   join_posix:
@@ -13671,7 +13678,10 @@ parseit:
             {
                 _invlist_intersection(this_range, PL_ASCII,
                                       &this_range);
-                _invlist_intersection(this_range, PL_Posix_ptrs[_CC_ALPHA],
+
+                /* Since this above only contains ascii, the intersection of it
+                 * with anything will still yield only ascii */
+                _invlist_intersection(this_range, PL_XPosix_ptrs[_CC_ALPHA],
                                       &this_range);
             }
             _invlist_union(cp_foldable_list, this_range, &cp_foldable_list);