summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2010-09-08 14:38:00 +0100
committerDavid Mitchell <davem@iabyn.com>2010-09-08 14:48:30 +0100
commitdf530c37b924f51b6982d30ba7e0934eb75f2b6d (patch)
treeb9cf50d5551748f5c3572625af7b6334f80f6e18 /pp_ctl.c
parentd873ee11fec56c8f6e86858fdb41e2a540ada0ea (diff)
downloadperl-df530c37b924f51b6982d30ba7e0934eb75f2b6d.tar.gz
create itervar_u union in struct block_loop
make it clearer what types of pointer to the iterator variable can be stored, reduce the amount of #ifdef USE_ITHREADS, get rid of some macros, and generally make the code easier to follow. No change to the size of the structure.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 93d167545b..9673d1290f 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1946,11 +1946,8 @@ PP(pp_enteriter)
dVAR; dSP; dMARK;
register PERL_CONTEXT *cx;
const I32 gimme = GIMME_V;
- SV **svp;
+ void *itervar; /* location of the iteration variable */
U8 cxtype = CXt_LOOP_FOR;
-#ifdef USE_ITHREADS
- PAD *iterdata;
-#endif
ENTER_with_name("loop1");
SAVETMPS;
@@ -1963,18 +1960,20 @@ PP(pp_enteriter)
}
SAVEPADSVANDMORTALIZE(PL_op->op_targ);
#ifndef USE_ITHREADS
- svp = &PAD_SVl(PL_op->op_targ); /* "my" variable */
+ itervar = &PAD_SVl(PL_op->op_targ); /* "my" variable */
#else
- iterdata = NULL;
+ itervar = PL_comppad;
#endif
}
else {
GV * const gv = MUTABLE_GV(POPs);
- svp = &GvSV(gv); /* symbol table variable */
+ SV** svp = &GvSV(gv); /* symbol table variable */
SAVEGENERICSV(*svp);
*svp = newSV(0);
#ifdef USE_ITHREADS
- iterdata = (PAD*)gv;
+ itervar = (void *)gv;
+#else
+ itervar = (void *)svp;
#endif
}
@@ -1984,11 +1983,7 @@ PP(pp_enteriter)
ENTER_with_name("loop2");
PUSHBLOCK(cx, cxtype, SP);
-#ifdef USE_ITHREADS
- PUSHLOOP_FOR(cx, iterdata, MARK, PL_op->op_targ);
-#else
- PUSHLOOP_FOR(cx, svp, MARK, 0);
-#endif
+ PUSHLOOP_FOR(cx, itervar, MARK);
if (PL_op->op_flags & OPf_STACKED) {
SV *maybe_ary = POPs;
if (SvTYPE(maybe_ary) != SVt_PVAV) {