From b5ed8c445e54e524b4713aa7b79e2f5aa3ed19ef Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Tue, 3 Jan 2012 22:59:32 -0800 Subject: [PATCH] =?utf8?q?Don=E2=80=99t=20iterate=20through=20magic=20with?= =?utf8?q?=20local=20$=5F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If we are going to skip all set-magic when restoring a localised tied $_, there’s no point in looping through it. --- mg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mg.c b/mg.c index 5e11ec4..54a41f0 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); -- 2.7.4