diff options
author | David Mitchell <davem@iabyn.com> | 2012-10-28 12:58:22 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2012-11-10 13:39:32 +0000 |
commit | 528ad060d8dbad9e971c22550cece80330a23dd3 (patch) | |
tree | cc1ed795c73d046021f13a921f4f693cff27b558 /scope.c | |
parent | 4e09461c68f4fd1b02cb93ceb753e6d3b4f6b786 (diff) | |
download | perl-528ad060d8dbad9e971c22550cece80330a23dd3.tar.gz |
reindent block in leave_scope
The previous commit added a loop round a block of code; now increase
the indent of the body of the loop.
Diffstat (limited to 'scope.c')
-rw-r--r-- | scope.c | 158 |
1 files changed, 79 insertions, 79 deletions
@@ -905,85 +905,85 @@ Perl_leave_scope(pTHX_ I32 base) i = 1; clearsv: for (; i; i--, svp--) { - sv = *svp; - - DEBUG_Xv(PerlIO_printf(Perl_debug_log, - "Pad 0x%"UVxf"[0x%"UVxf"] clearsv: %ld sv=0x%"UVxf"<%"IVdf"> %s\n", - PTR2UV(PL_comppad), PTR2UV(PL_curpad), - (long)(svp-PL_curpad), PTR2UV(sv), (IV)SvREFCNT(sv), - (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) ? "clear" : "abandon" - )); - - /* Can clear pad variable in place? */ - if (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) { - /* - * if a my variable that was made readonly is going out of - * scope, we want to remove the readonlyness so that it can - * go out of scope quietly - */ - if (SvPADMY(sv) && !SvFAKE(sv)) - SvREADONLY_off(sv); - - if (SvTHINKFIRST(sv)) - sv_force_normal_flags(sv, SV_IMMEDIATE_UNREF - |SV_COW_DROP_PV); - if (SvTYPE(sv) == SVt_PVHV) - Perl_hv_kill_backrefs(aTHX_ MUTABLE_HV(sv)); - if (SvMAGICAL(sv)) - { - sv_unmagic(sv, PERL_MAGIC_backref); - if (SvTYPE(sv) != SVt_PVCV) - mg_free(sv); - } - - switch (SvTYPE(sv)) { - case SVt_NULL: - break; - case SVt_PVAV: - av_clear(MUTABLE_AV(sv)); - break; - case SVt_PVHV: - hv_clear(MUTABLE_HV(sv)); - break; - case SVt_PVCV: - { - HEK * const hek = CvNAME_HEK((CV *)sv); - assert(hek); - share_hek_hek(hek); - cv_undef((CV *)sv); - CvNAME_HEK_set(sv, hek); - break; - } - default: - SvOK_off(sv); - break; - } - SvPADSTALE_on(sv); /* mark as no longer live */ - } - else { /* Someone has a claim on this, so abandon it. */ - assert( SvFLAGS(sv) & SVs_PADMY); - assert(!(SvFLAGS(sv) & SVs_PADTMP)); - switch (SvTYPE(sv)) { /* Console ourselves with a new value */ - case SVt_PVAV: *svp = MUTABLE_SV(newAV()); break; - case SVt_PVHV: *svp = MUTABLE_SV(newHV()); break; - case SVt_PVCV: - { - /* Create a stub */ - *svp = newSV_type(SVt_PVCV); - - /* Share name */ - assert(CvNAMED(sv)); - CvNAME_HEK_set(*svp, - share_hek_hek(CvNAME_HEK((CV *)sv))); - break; - } - default: *svp = newSV(0); break; - } - SvREFCNT_dec(sv); /* Cast current value to the winds. */ - /* preserve pad nature, but also mark as not live - * for any closure capturing */ - SvFLAGS(*svp) |= (SVs_PADMY|SVs_PADSTALE); - } + sv = *svp; + + DEBUG_Xv(PerlIO_printf(Perl_debug_log, + "Pad 0x%"UVxf"[0x%"UVxf"] clearsv: %ld sv=0x%"UVxf"<%"IVdf"> %s\n", + PTR2UV(PL_comppad), PTR2UV(PL_curpad), + (long)(svp-PL_curpad), PTR2UV(sv), (IV)SvREFCNT(sv), + (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) ? "clear" : "abandon" + )); + + /* Can clear pad variable in place? */ + if (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) { + /* + * if a my variable that was made readonly is going out of + * scope, we want to remove the readonlyness so that it can + * go out of scope quietly + */ + if (SvPADMY(sv) && !SvFAKE(sv)) + SvREADONLY_off(sv); + + if (SvTHINKFIRST(sv)) + sv_force_normal_flags(sv, SV_IMMEDIATE_UNREF + |SV_COW_DROP_PV); + if (SvTYPE(sv) == SVt_PVHV) + Perl_hv_kill_backrefs(aTHX_ MUTABLE_HV(sv)); + if (SvMAGICAL(sv)) + { + sv_unmagic(sv, PERL_MAGIC_backref); + if (SvTYPE(sv) != SVt_PVCV) + mg_free(sv); + } + + switch (SvTYPE(sv)) { + case SVt_NULL: + break; + case SVt_PVAV: + av_clear(MUTABLE_AV(sv)); + break; + case SVt_PVHV: + hv_clear(MUTABLE_HV(sv)); + break; + case SVt_PVCV: + { + HEK * const hek = CvNAME_HEK((CV *)sv); + assert(hek); + share_hek_hek(hek); + cv_undef((CV *)sv); + CvNAME_HEK_set(sv, hek); + break; + } + default: + SvOK_off(sv); + break; + } + SvPADSTALE_on(sv); /* mark as no longer live */ + } + else { /* Someone has a claim on this, so abandon it. */ + assert( SvFLAGS(sv) & SVs_PADMY); + assert(!(SvFLAGS(sv) & SVs_PADTMP)); + switch (SvTYPE(sv)) { /* Console ourselves with a new value */ + case SVt_PVAV: *svp = MUTABLE_SV(newAV()); break; + case SVt_PVHV: *svp = MUTABLE_SV(newHV()); break; + case SVt_PVCV: + { + /* Create a stub */ + *svp = newSV_type(SVt_PVCV); + + /* Share name */ + assert(CvNAMED(sv)); + CvNAME_HEK_set(*svp, + share_hek_hek(CvNAME_HEK((CV *)sv))); + break; + } + default: *svp = newSV(0); break; + } + SvREFCNT_dec(sv); /* Cast current value to the winds. */ + /* preserve pad nature, but also mark as not live + * for any closure capturing */ + SvFLAGS(*svp) |= (SVs_PADMY|SVs_PADSTALE); + } } break; } |