This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Compress-Raw-Bzip2 to CPAN version 2.037
[perl5.git] / regexec.c
index 6b32aa2..3dd7ba5 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -1447,14 +1447,13 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s,
                utf8_fold_flags = 0;
                goto do_exactf_utf8;
            }
+
+           /* Any 'ss' in the pattern should have been replaced by regcomp,
+            * so we don't have to worry here about this single special case
+            * in the Latin1 range */
            fold_array = PL_fold_latin1;
            folder = foldEQ_latin1;
-           /* XXX This uses the full utf8 fold because if the pattern contains
-            * 'ss' it could match LATIN_SMALL_LETTER SHARP_S in the string.
-            * There could be a new node type, say EXACTFU_SS, which is
-            * generated by regcomp only if there is an 'ss', and then every
-            * other case could goto do_exactf_non_utf8;*/
-           goto do_exactf_utf8;
+           goto do_exactf_non_utf8;
 
        case EXACTF:
            if (UTF_PATTERN || utf8_target) {
@@ -6887,16 +6886,16 @@ S_to_utf8_substr(pTHX_ register regexp *prog)
            prog->substrs->data[i].utf8_substr = sv;
            sv_utf8_upgrade(sv);
            if (SvVALID(prog->substrs->data[i].substr)) {
-               const U8 flags = BmFLAGS(prog->substrs->data[i].substr);
-               if (flags & FBMcf_TAIL) {
+               if (SvTAIL(prog->substrs->data[i].substr)) {
                    /* Trim the trailing \n that fbm_compile added last
                       time.  */
                    SvCUR_set(sv, SvCUR(sv) - 1);
                    /* Whilst this makes the SV technically "invalid" (as its
                       buffer is no longer followed by "\0") when fbm_compile()
                       adds the "\n" back, a "\0" is restored.  */
-               }
-               fbm_compile(sv, flags);
+                   fbm_compile(sv, FBMcf_TAIL);
+               } else
+                   fbm_compile(sv, 0);
            }
            if (prog->substrs->data[i].substr == prog->check_substr)
                prog->check_utf8 = sv;
@@ -6918,15 +6917,14 @@ S_to_byte_substr(pTHX_ register regexp *prog)
            SV* sv = newSVsv(prog->substrs->data[i].utf8_substr);
            if (sv_utf8_downgrade(sv, TRUE)) {
                if (SvVALID(prog->substrs->data[i].utf8_substr)) {
-                   const U8 flags
-                       = BmFLAGS(prog->substrs->data[i].utf8_substr);
-                   if (flags & FBMcf_TAIL) {
+                   if (SvTAIL(prog->substrs->data[i].utf8_substr)) {
                        /* Trim the trailing \n that fbm_compile added last
                           time.  */
                        SvCUR_set(sv, SvCUR(sv) - 1);
-                   }
-                   fbm_compile(sv, flags);
-               }           
+                       fbm_compile(sv, FBMcf_TAIL);
+                   } else
+                       fbm_compile(sv, 0);
+               }
            } else {
                SvREFCNT_dec(sv);
                sv = &PL_sv_undef;