else if (CxTYPE(cx) == CXt_LOOP_FOR) \
SvREFCNT_dec(cx->blk_loop.state_u.ary.ary); \
if (cx->cx_type & (CXp_FOR_PAD|CXp_FOR_GV)) { \
- SV **svp = (cx)->blk_loop.itervar_u.svp; \
SV *cursv; \
- if ((cx->cx_type & CXp_FOR_GV)) { \
+ SV **svp = (cx)->blk_loop.itervar_u.svp; \
+ if ((cx->cx_type & CXp_FOR_GV)) \
svp = &GvSV((GV*)svp); \
- cursv = *svp; \
- *svp = cx->blk_loop.itersave; \
- } \
- else { \
- cursv = *svp; \
- *svp = cx->blk_loop.itersave; \
- } \
+ cursv = *svp; \
+ *svp = cx->blk_loop.itersave; \
SvREFCNT_dec(cursv); \
}
SvREFCNT_inc_simple_void_NN(itersave);
cxtype |= CXp_FOR_PAD;
}
- else if (LIKELY(isGV(TOPs))) { /* symbol table variable */
- GV * const gv = MUTABLE_GV(POPs);
- SV** svp = &GvSV(gv);
- itervarp = (void *)gv;
- itersave = *svp;
- if (LIKELY(itersave))
- SvREFCNT_inc_simple_void_NN(itersave);
- else
- *svp = newSV(0);
- cxtype |= CXp_FOR_GV;
- }
else {
SV * const sv = POPs;
- assert(SvTYPE(sv) == SVt_PVMG);
- assert(SvMAGIC(sv));
- assert(SvMAGIC(sv)->mg_type == PERL_MAGIC_lvref);
itervarp = (void *)sv;
- cxtype |= CXp_FOR_LVREF;
- itersave = NULL;
+ if (LIKELY(isGV(sv))) { /* symbol table variable */
+ SV** svp = &GvSV(sv);
+ itersave = *svp;
+ if (LIKELY(itersave))
+ SvREFCNT_inc_simple_void_NN(itersave);
+ else
+ *svp = newSV(0);
+ cxtype |= CXp_FOR_GV;
+ }
+ else { /* LV ref: for \$foo (...) */
+ assert(SvTYPE(sv) == SVt_PVMG);
+ assert(SvMAGIC(sv));
+ assert(SvMAGIC(sv)->mg_type == PERL_MAGIC_lvref);
+ itersave = NULL;
+ cxtype |= CXp_FOR_LVREF;
+ }
}
if (PL_op->op_private & OPpITER_DEF)