summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dragan <bulk88@hotmail.com>2014-07-13 08:20:31 -0400
committerTony Cook <tony@develop-help.com>2015-06-11 14:46:06 +1000
commit4b523e790cc5594fb19013dc23adfb6a5b34f824 (patch)
tree3646f84f3844b0eba00aa18db0fa15479c2221be
parent26fd36cc4555411f2f78ef8d28236ddb60fd0a67 (diff)
downloadperl-4b523e790cc5594fb19013dc23adfb6a5b34f824.tar.gz
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
-rw-r--r--pp_ctl.c4
-rw-r--r--pp_sys.c6
-rw-r--r--universal.c2
3 files changed, 7 insertions, 5 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 335fb2101e..6490140822 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 38537f3280..beca14a879 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 4b650c5e9e..58b010b4d5 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;