diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-01-03 22:59:32 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-01-04 23:54:34 -0800 |
commit | b5ed8c445e54e524b4713aa7b79e2f5aa3ed19ef (patch) | |
tree | 1653cbec2955ec0ccbab8f1900a8ca9139ee4105 | |
parent | 7c2b3c783b7cfdd1c2c7d51e431850e6b2be74ae (diff) | |
download | perl-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.
-rw-r--r-- | mg.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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); |