This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add BmPREVIOUS_set(), and use it in the one place that BmPREVIOUS is
authorNicholas Clark <nick@ccl4.org>
Mon, 11 Dec 2006 22:52:46 +0000 (22:52 +0000)
committerNicholas Clark <nick@ccl4.org>
Mon, 11 Dec 2006 22:52:46 +0000 (22:52 +0000)
modified.

p4raw-id: //depot/perl@29525

sv.h
util.c

diff --git a/sv.h b/sv.h
index 8c98c89..a80a0ac 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -1347,6 +1347,9 @@ the scalar's value cannot change unless written to.
 #  define BmUSEFUL(sv) ((XPVBM*)  SvANY(sv))->xiv_u.xivu_i32
 #  define BmPREVIOUS(sv)       ((XPVBM*)  SvANY(sv))->xbm_previous
 #endif
+#define BmPREVIOUS_set(sv, val)                                                \
+    STMT_START { assert(SvTYPE(sv) == SVt_PVBM);                       \
+       (((XPVBM*)SvANY(sv))->xbm_previous = (U16)(val)); } STMT_END
 
 #define FmLINES(sv)    ((XPVFM*)  SvANY(sv))->xfm_lines
 
diff --git a/util.c b/util.c
index daf88da..1ae9459 100644 (file)
--- a/util.c
+++ b/util.c
@@ -522,7 +522,7 @@ Perl_fbm_compile(pTHX_ SV *sv, U32 flags)
        }
     }
     BmRARE(sv) = s[rarest];
-    BmPREVIOUS(sv) = (U16)rarest;
+    BmPREVIOUS_set(sv, rarest);
     BmUSEFUL(sv) = 100;                        /* Initial value */
     if (flags & FBMcf_TAIL)
        SvTAIL_on(sv);