This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use SvTAIL() instead of BmFLAGS(). The core no longer uses BmFLAGS().
authorNicholas Clark <nick@ccl4.org>
Mon, 9 May 2011 15:53:28 +0000 (16:53 +0100)
committerNicholas Clark <nick@ccl4.org>
Sat, 11 Jun 2011 07:40:02 +0000 (09:40 +0200)
dump.c
ext/Devel-Peek/t/Peek.t
regexec.c
sv.h
util.c

diff --git a/dump.c b/dump.c
index 564b198..b541aa1 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -2090,7 +2090,6 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
                    dumpops, pvlim);
        }
        if (SvVALID(sv)) {
                    dumpops, pvlim);
        }
        if (SvVALID(sv)) {
-           Perl_dump_indent(aTHX_ level, file, "  FLAGS = %u\n", (U8)BmFLAGS(sv));
            Perl_dump_indent(aTHX_ level, file, "  RARE = %u\n", (U8)BmRARE(sv));
            Perl_dump_indent(aTHX_ level, file, "  PREVIOUS = %"UVuf"\n", (UV)BmPREVIOUS(sv));
            Perl_dump_indent(aTHX_ level, file, "  USEFUL = %"IVdf"\n", (IV)BmUSEFUL(sv));
            Perl_dump_indent(aTHX_ level, file, "  RARE = %u\n", (U8)BmRARE(sv));
            Perl_dump_indent(aTHX_ level, file, "  PREVIOUS = %"UVuf"\n", (UV)BmPREVIOUS(sv));
            Perl_dump_indent(aTHX_ level, file, "  USEFUL = %"IVdf"\n", (IV)BmUSEFUL(sv));
index 16bfba4..715d7f0 100644 (file)
@@ -816,7 +816,6 @@ unless ($Config{useithreads}) {
   MAGIC = $ADDR
     MG_VIRTUAL = &PL_vtbl_bm
     MG_TYPE = PERL_MAGIC_bm\\(B\\)
   MAGIC = $ADDR
     MG_VIRTUAL = &PL_vtbl_bm
     MG_TYPE = PERL_MAGIC_bm\\(B\\)
-  FLAGS = 0
   RARE = \d+
   PREVIOUS = 1
   USEFUL = 100
   RARE = \d+
   PREVIOUS = 1
   USEFUL = 100
@@ -834,7 +833,6 @@ unless ($Config{useithreads}) {
   MAGIC = $ADDR
     MG_VIRTUAL = &PL_vtbl_bm
     MG_TYPE = PERL_MAGIC_bm\\(B\\)
   MAGIC = $ADDR
     MG_VIRTUAL = &PL_vtbl_bm
     MG_TYPE = PERL_MAGIC_bm\\(B\\)
-  FLAGS = 0
   RARE = \d+
   PREVIOUS = 1
   USEFUL = 100
   RARE = \d+
   PREVIOUS = 1
   USEFUL = 100
index 6b32aa2..7587a7d 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -6887,16 +6887,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)) {
            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.  */
                    /* 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;
            }
            if (prog->substrs->data[i].substr == prog->check_substr)
                prog->check_utf8 = sv;
@@ -6918,15 +6918,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)) {
            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);
                        /* 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;
            } else {
                SvREFCNT_dec(sv);
                sv = &PL_sv_undef;
diff --git a/sv.h b/sv.h
index e4e1f7a..04a45c2 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -1295,7 +1295,9 @@ the scalar's value cannot change unless written to.
    perl -T -e '/$^X/'
 */
 
    perl -T -e '/$^X/'
 */
 
-#define BmFLAGS(sv)            (SvTAIL(sv) ? FBMcf_TAIL : 0)
+#ifndef PERL_CORE
+#  define BmFLAGS(sv)          (SvTAIL(sv) ? FBMcf_TAIL : 0)
+#endif
 
 #if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
 #  define BmRARE(sv)                                                   \
 
 #if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
 #  define BmRARE(sv)                                                   \
diff --git a/util.c b/util.c
index 24a482f..1111ff1 100644 (file)
--- a/util.c
+++ b/util.c
@@ -804,7 +804,7 @@ Perl_fbm_instr(pTHX_ unsigned char *big, register unsigned char *bigend, SV *lit
        }
       check_end:
        if ( s == bigend
        }
       check_end:
        if ( s == bigend
-            && (BmFLAGS(littlestr) & FBMcf_TAIL)
+            && SvTAIL(littlestr)
             && memEQ((char *)(bigend - littlelen),
                      (char *)(oldlittle - littlelen), littlelen) )
            return (char*)bigend - littlelen;
             && memEQ((char *)(bigend - littlelen),
                      (char *)(oldlittle - littlelen), littlelen) )
            return (char*)bigend - littlelen;