diff options
author | Ilya Zakharevich <ilya@math.berkeley.edu> | 1998-07-11 14:21:21 -0400 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-11 22:35:40 +0000 |
commit | 7f61b687036bb8a098a2e70b387919a448b7bd62 (patch) | |
tree | 3e6e902d23d2edcdecf4bf0db42e6bcaaf2ba61e /pp_hot.c | |
parent | 5f8e730b530d1a9f84c2333a1f2ca080d2fb3303 (diff) | |
download | perl-7f61b687036bb8a098a2e70b387919a448b7bd62.tar.gz |
Update os2's OS2::Process
Message-Id: <199807112221.SAA03221@monk.mps.ohio-state.edu>
p4raw-id: //depot/perl@1441
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1447,7 +1447,11 @@ PP(pp_iter) STRLEN maxlen; char *max = SvPV((SV*)av, maxlen); if (!SvNIOK(cur) && SvCUR(cur) <= maxlen) { - sv_setsv(*cx->blk_loop.itervar, cur); + /* we need a fresh SV every time so that loop body sees a + * completely new SV for closures/references to work as they + * used to */ + SvREFCNT_dec(*cx->blk_loop.itervar); + *cx->blk_loop.itervar = newSVsv(cur); if (strEQ(SvPVX(cur), max)) sv_setiv(cur, 0); /* terminate next time */ else @@ -1459,7 +1463,12 @@ PP(pp_iter) /* integer increment */ if (cx->blk_loop.iterix > cx->blk_loop.itermax) RETPUSHNO; - sv_setiv(*cx->blk_loop.itervar, cx->blk_loop.iterix++); + + /* we need a fresh SV every time so that loop body sees a + * completely new SV for closures/references to work as they + * used to */ + SvREFCNT_dec(*cx->blk_loop.itervar); + *cx->blk_loop.itervar = newSViv(cx->blk_loop.iterix++); RETPUSHYES; } |