diff options
author | Vincent Pit <perl@profvince.com> | 2008-02-09 00:22:19 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2008-03-10 12:56:41 +0000 |
commit | 218787bdb7a9250de0cc00118d84dcb23ff2f1c5 (patch) | |
tree | d58fca3abb8ca3344254998083498ae02f53162e /mg.c | |
parent | 3788ef8ffa548a64c7425dab843bc6e906dec25c (diff) | |
download | perl-218787bdb7a9250de0cc00118d84dcb23ff2f1c5.tar.gz |
Re: [PATCH] mg_magical() sometimes turns SvRMAGICAL on when it shouldn't
Message-ID: <47ACD61B.6030501@profvince.com>
p4raw-id: //depot/perl@33458
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 25 |
1 files changed, 15 insertions, 10 deletions
@@ -123,16 +123,21 @@ Perl_mg_magical(pTHX_ SV *sv) const MAGIC* mg; PERL_ARGS_ASSERT_MG_MAGICAL; PERL_UNUSED_CONTEXT; - for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) { - const MGVTBL* const vtbl = mg->mg_virtual; - if (vtbl) { - if (vtbl->svt_get && !(mg->mg_flags & MGf_GSKIP)) - SvGMAGICAL_on(sv); - if (vtbl->svt_set) - SvSMAGICAL_on(sv); - if (!(SvFLAGS(sv) & (SVs_GMG|SVs_SMG)) || vtbl->svt_clear) - SvRMAGICAL_on(sv); - } + if ((mg = SvMAGIC(sv))) { + SvRMAGICAL_off(sv); + do { + const MGVTBL* const vtbl = mg->mg_virtual; + if (vtbl) { + if (vtbl->svt_get && !(mg->mg_flags & MGf_GSKIP)) + SvGMAGICAL_on(sv); + if (vtbl->svt_set) + SvSMAGICAL_on(sv); + if (vtbl->svt_clear) + SvRMAGICAL_on(sv); + } + } while ((mg = mg->mg_moremagic)); + if (!(SvFLAGS(sv) & (SVs_GMG|SVs_SMG))) + SvRMAGICAL_on(sv); } } |