Assert that BmRARE() BmPREVIOUS() and BmUSEFUL() are only called on
Nicholas Clark [Mon, 11 Dec 2006 21:15:06 +0000 (21:15 +0000)]
valid PVBMs.

p4raw-id: //depot/perl@29521

sv.h

diff --git a/sv.h b/sv.h
index 379175a..c919e93 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -1314,17 +1314,20 @@ the scalar's value cannot change unless written to.
 #  define BmRARE(sv)                                                   \
        (*({ SV *const _svi = (SV *) (sv);                              \
            assert(SvTYPE(_svi) == SVt_PVBM);                           \
+           assert(SvVALID(_svi));                                      \
            &(((XPVBM*) SvANY(_svi))->xbm_rare);                        \
         }))
 #  define BmUSEFUL(sv)                                                 \
        (*({ SV *const _svi = (SV *) (sv);                              \
            assert(SvTYPE(_svi) == SVt_PVBM);                           \
+           assert(SvVALID(_svi));                                      \
            assert(!SvIOK(_svi));                                       \
            &(((XPVBM*) SvANY(_svi))->xiv_u.xivu_i32);                  \
         }))
 #  define BmPREVIOUS(sv)                                               \
        (*({ SV *const _svi = (SV *) (sv);                              \
            assert(SvTYPE(_svi) == SVt_PVBM);                           \
+           assert(SvVALID(_svi));                                      \
            &(((XPVBM*) SvANY(_svi))->xbm_previous);                    \
         }))
 #else