summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-01-03 22:59:32 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-01-04 23:54:34 -0800
commitb5ed8c445e54e524b4713aa7b79e2f5aa3ed19ef (patch)
tree1653cbec2955ec0ccbab8f1900a8ca9139ee4105 /mg.c
parent7c2b3c783b7cfdd1c2c7d51e431850e6b2be74ae (diff)
downloadperl-b5ed8c445e54e524b4713aa7b79e2f5aa3ed19ef.tar.gz
Don’t iterate through magic with local $_
If we are going to skip all set-magic when restoring a localised tied $_, there’s no point in looping through it.
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mg.c b/mg.c
index 5e11ec4e42..54a41f0335 100644
--- a/mg.c
+++ b/mg.c
@@ -253,6 +253,8 @@ Perl_mg_set(pTHX_ SV *sv)
PERL_ARGS_ASSERT_MG_SET;
+ if (PL_localizing == 2 && sv == DEFSV) return 0;
+
save_magic(mgs_ix, sv);
for (mg = SvMAGIC(sv); mg; mg = nextmg) {
@@ -263,7 +265,7 @@ Perl_mg_set(pTHX_ SV *sv)
(SSPTR(mgs_ix, MGS*))->mgs_magical = 0;
}
if (PL_localizing == 2
- && (PERL_MAGIC_TYPE_IS_VALUE_MAGIC(mg->mg_type) || sv == DEFSV))
+ && PERL_MAGIC_TYPE_IS_VALUE_MAGIC(mg->mg_type))
continue;
if (vtbl && vtbl->svt_set)
vtbl->svt_set(aTHX_ sv, mg);