summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorStephen McCamant <smcc@mit.edu>1998-07-28 17:18:25 -0500
committerGurusamy Sarathy <gsar@cpan.org>1998-08-02 03:42:26 +0000
commit39ca2bb7cd8f975c0e460242f7deaed80ab31ddc (patch)
tree9dd864c778d602fc7268029583646883de1de7ab /pp_hot.c
parenta8693bd382efcc6d770233a60c0e99bac574fc57 (diff)
downloadperl-39ca2bb7cd8f975c0e460242f7deaed80ab31ddc.tar.gz
avoid reusing foreach itervar if magic got tacked onto it
Message-ID: <13758.36756.215424.719750@alias-2.pr.mcs.net> Subject: [PATCH] Re: pos() resetting changed with 5.005? p4raw-id: //depot/maint-5.005/perl@1682
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pp_hot.c b/pp_hot.c
index d0fdbfc164..29f654219a 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1460,7 +1460,9 @@ PP(pp_iter)
char *max = SvPV((SV*)av, maxlen);
if (!SvNIOK(cur) && SvCUR(cur) <= maxlen) {
#ifndef USE_THREADS /* don't risk potential race */
- if (SvREFCNT(*cx->blk_loop.itervar) == 1) {
+ if (SvREFCNT(*cx->blk_loop.itervar) == 1
+ && !SvMAGICAL(*cx->blk_loop.itervar))
+ {
/* safe to reuse old SV */
sv_setsv(*cx->blk_loop.itervar, cur);
}
@@ -1486,7 +1488,9 @@ PP(pp_iter)
RETPUSHNO;
#ifndef USE_THREADS /* don't risk potential race */
- if (SvREFCNT(*cx->blk_loop.itervar) == 1) {
+ if (SvREFCNT(*cx->blk_loop.itervar) == 1
+ && !SvMAGICAL(*cx->blk_loop.itervar))
+ {
/* safe to reuse old SV */
sv_setiv(*cx->blk_loop.itervar, cx->blk_loop.iterix++);
}