diff options
-rw-r--r-- | gv.h | 1 | ||||
-rw-r--r-- | sv.c | 6 | ||||
-rw-r--r-- | sv.h | 3 | ||||
-rw-r--r-- | util.c | 5 |
4 files changed, 8 insertions, 7 deletions
@@ -52,7 +52,6 @@ struct gp { (*({ GV * const _gvname_hek = (GV *) (gv); \ assert(isGV_with_GP(_gvname_hek)); \ assert(SvTYPE(_gvname_hek) == SVt_PVGV || SvTYPE(_gvname_hek) >= SVt_PVLV); \ - assert(!SvVALID((SV*)_gvname_hek)); \ &(GvXPVGV(_gvname_hek)->xiv_u.xivu_namehek); \ })) # define GvNAME_get(gv) ({ assert(GvNAME_HEK(gv)); (char *)HEK_KEY(GvNAME_HEK(gv)); }) @@ -2449,8 +2449,8 @@ Perl_sv_2iv_flags(pTHX_ SV *const sv, const I32 flags) } if (SvVALID(sv) || isREGEXP(sv)) { - /* FBMs use the space for SvIVX and SvNVX for other purposes, and use - the same flag bit as SVf_IVisUV, so must not let them cache IVs. + /* FBMs use the space for SvIVX and SvNVX for other purposes, so + must not let them cache IVs. In practice they are extremely unlikely to actually get anywhere accessible by user Perl code - the only way that I'm aware of is when a constant subroutine which is used as the second argument to index. @@ -6626,7 +6626,7 @@ Perl_sv_clear(pTHX_ SV *const orig_sv) /* If we're in a stash, we don't own a reference to it. * However it does have a back reference to us, which * needs to be cleared. */ - if (!SvVALID(sv) && (stash = GvSTASH(sv))) + if ((stash = GvSTASH(sv))) sv_del_backref(MUTABLE_SV(stash), sv); } /* FIXME. There are probably more unreferenced pointers to SVs @@ -1118,7 +1118,8 @@ object type. Exposed to perl code via Internals::SvREADONLY(). /* Does the SV have a Boyer-Moore table attached as magic? * 'VALID' is a poor name, but is kept for historical reasons. */ #define SvVALID(_svvalid) ( \ - SvSMAGICAL(_svvalid) \ + SvPOKp(_svvalid) \ + && SvSMAGICAL(_svvalid) \ && SvMAGIC(_svvalid) \ && (SvMAGIC(_svvalid)->mg_type == PERL_MAGIC_bm \ || mg_find(_svvalid, PERL_MAGIC_bm)) \ @@ -811,7 +811,8 @@ Perl_fbm_instr(pTHX_ unsigned char *big, unsigned char *bigend, SV *littlestr, U const unsigned char *little = (const unsigned char *)SvPV_const(littlestr,l); STRLEN littlelen = l; const I32 multiline = flags & FBMrf_MULTILINE; - bool tail = SvVALID(littlestr) ? cBOOL(SvTAIL(littlestr)) : FALSE; + bool valid = SvVALID(littlestr); + bool tail = valid ? cBOOL(SvTAIL(littlestr)) : FALSE; PERL_ARGS_ASSERT_FBM_INSTR; @@ -945,7 +946,7 @@ Perl_fbm_instr(pTHX_ unsigned char *big, unsigned char *bigend, SV *littlestr, U return NULL; } - if (!SvVALID(littlestr)) { + if (!valid) { /* not compiled; use Perl_ninstr() instead */ char * const b = ninstr((char*)big,(char*)bigend, (char*)little, (char*)little + littlelen); |