In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/4b523e790cc5594fb19013dc23adfb6a5b34f824?hp=26fd36cc4555411f2f78ef8d28236ddb60fd0a67>
- Log ----------------------------------------------------------------- commit 4b523e790cc5594fb19013dc23adfb6a5b34f824 Author: Daniel Dragan <[email protected]> Date: Sun Jul 13 08:20:31 2014 -0400 clean up sv_isobject usage -previous usage proves getmagic is unnecessary or ignored or already called S_do_smartmatch Perl_sv_does_sv -in pp_dbmopen dont call sv_isobject twice in a row on the same SV in 1 permutation ----------------------------------------------------------------------- Summary of changes: pp_ctl.c | 4 ++-- pp_sys.c | 6 ++++-- universal.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pp_ctl.c b/pp_ctl.c index 335fb21..6490140 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -4599,11 +4599,11 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other, const bool copied) RETPUSHYES; } - if (sv_isobject(e) && (SvTYPE(SvRV(e)) != SVt_REGEXP)) { + if (SvROK(e) && SvOBJECT(SvRV(e)) && (SvTYPE(SvRV(e)) != SVt_REGEXP)) { DEBUG_M(Perl_deb(aTHX_ " applying rule Any-Object\n")); Perl_croak(aTHX_ "Smart matching a non-overloaded object breaks encapsulation"); } - if (sv_isobject(d) && (SvTYPE(SvRV(d)) != SVt_REGEXP)) + if (SvROK(d) && SvOBJECT(SvRV(d)) && (SvTYPE(SvRV(d)) != SVt_REGEXP)) object_on_left = TRUE; /* ~~ sub */ diff --git a/pp_sys.c b/pp_sys.c index 38537f3..beca14a 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -1082,9 +1082,11 @@ PP(pp_dbmopen) PUTBACK; call_sv(MUTABLE_SV(GvCV(gv)), G_SCALAR); SPAGAIN; + if (sv_isobject(TOPs)) + goto retie; } - - if (sv_isobject(TOPs)) { + else { + retie: sv_unmagic(MUTABLE_SV(hv), PERL_MAGIC_tied); sv_magic(MUTABLE_SV(hv), TOPs, PERL_MAGIC_tied, NULL, 0); } diff --git a/universal.c b/universal.c index 4b650c5..58b010b 100644 --- a/universal.c +++ b/universal.c @@ -205,7 +205,7 @@ Perl_sv_does_sv(pTHX_ SV *sv, SV *namesv, U32 flags) return FALSE; } - if (sv_isobject(sv)) { + if (SvROK(sv) && SvOBJECT(SvRV(sv))) { classname = sv_ref(NULL,SvRV(sv),TRUE); } else { classname = sv; -- Perl5 Master Repository
