This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Fix an optimization criterium
authorKarl Williamson <khw@cpan.org>
Fri, 29 Dec 2017 21:54:17 +0000 (14:54 -0700)
committerKarl Williamson <khw@cpan.org>
Sat, 30 Dec 2017 05:45:14 +0000 (22:45 -0700)
/[...]/ patterns get optimized into Posix ones if they match the same
things, as the latter are somewhat speedier.  The code that checks if
they match was off-by-one, so that it didn't check for a match for \v.

regcomp.c

index 549ac75..645d090 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -18097,7 +18097,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
                  * can be executed unnecessarily.  It will still give the
                  * correct answer. */
 
-            if (cp_list_array[cp_list_len-1] > 0x2029) {
+            if (cp_list_array[cp_list_len-1] >= 0x2029) {
                 for (posix_class = 0;
                      posix_class <= _HIGHEST_REGCOMP_DOT_H_SYNC;
                      posix_class++)