summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-11-18 17:07:12 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-11-18 17:07:12 +0000
commit976c8a39d49b217cde66f5408b0c0e7431507598 (patch)
tree993053f7ca20e8a70fb9e0975f8ea7ec53357b5a /pp.c
parentf36eea1037c5e636f0a49c0b179f8f7dce70d331 (diff)
downloadperl-976c8a39d49b217cde66f5408b0c0e7431507598.tar.gz
Retract 11635: close 20011113.110, reopen 20010809.028.
Tiny problem in the test for 20011113.110: I hope 'my $x= [("foo") x 1]' was never going to produce [qw(foo foo)] :-) p4raw-id: //depot/perl@13077
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/pp.c b/pp.c
index d6d0534817..9407fd47cd 100644
--- a/pp.c
+++ b/pp.c
@@ -1256,10 +1256,33 @@ PP(pp_repeat)
MEXTEND(MARK, max);
if (count > 1) {
while (SP > MARK) {
+#if 0
+ /* This code was intended to fix 20010809.028:
+
+ $x = 'abcd';
+ for (($x =~ /./g) x 2) {
+ print chop; # "abcdabcd" expected as output.
+ }
+
+ * but that change (#11635) broke this code:
+
+ $x = [("foo")x2]; # only one "foo" ended up in the anonlist.
+
+ * I can't think of a better fix that doesn't introduce
+ * an efficiency hit by copying the SVs. The stack isn't
+ * refcounted, and mortalisation obviously doesn't
+ * Do The Right Thing when the stack has more than
+ * one pointer to the same mortal value.
+ * .robin.
+ */
if (*SP) {
*SP = sv_2mortal(newSVsv(*SP));
SvREADONLY_on(*SP);
}
+#else
+ if (*SP)
+ SvTEMP_off((*SP));
+#endif
SP--;
}
MARK++;