Makes the code neater and slightly faster
EXTEND(SP, 1);
cx = &cxstack[cxstack_ix];
EXTEND(SP, 1);
cx = &cxstack[cxstack_ix];
- if (!CxTYPE_is_LOOP(cx))
- DIE(aTHX_ "panic: pp_iter, type=%u", CxTYPE(cx));
-
- if (CxTYPE(cx) == CXt_LOOP_LAZYSV) {
+
+ switch (CxTYPE(cx)) {
+ case CXt_LOOP_LAZYSV:
+ {
/* string increment */
SV* cur = cx->blk_loop.state_u.lazysv.cur;
SV *end = cx->blk_loop.state_u.lazysv.end;
/* string increment */
SV* cur = cx->blk_loop.state_u.lazysv.cur;
SV *end = cx->blk_loop.state_u.lazysv.end;
- }
- else if (CxTYPE(cx) == CXt_LOOP_LAZYIV) {
+ break;
+ }
+
+ case CXt_LOOP_LAZYIV:
/* integer increment */
if (cx->blk_loop.state_u.lazyiv.cur > cx->blk_loop.state_u.lazyiv.end)
RETPUSHNO;
/* integer increment */
if (cx->blk_loop.state_u.lazyiv.cur > cx->blk_loop.state_u.lazyiv.end)
RETPUSHNO;
cx->blk_loop.state_u.lazyiv.end = IV_MIN;
} else
++cx->blk_loop.state_u.lazyiv.cur;
cx->blk_loop.state_u.lazyiv.end = IV_MIN;
} else
++cx->blk_loop.state_u.lazyiv.cur;
+ break;
+
+ case CXt_LOOP_FOR:
- assert(CxTYPE(cx) == CXt_LOOP_FOR);
av = cx->blk_loop.state_u.ary.ary;
if (!av) {
av_is_stack = TRUE;
av = cx->blk_loop.state_u.ary.ary;
if (!av) {
av_is_stack = TRUE;
SvREFCNT_dec(oldsv);
RETPUSHYES;
SvREFCNT_dec(oldsv);
RETPUSHYES;
+ break;
+
+ default:
+ DIE(aTHX_ "panic: pp_iter, type=%u", CxTYPE(cx));
+ }