This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
A suggestion by Yamashina Hio to speed up substitutions
authorYAMASHINA Hio <hio@ymir.co.jp>
Tue, 30 Aug 2005 17:17:23 +0000 (02:17 +0900)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Mon, 12 Dec 2005 16:03:00 +0000 (16:03 +0000)
with right-hand side expressions by freeing temporaries.
See :

Subject: s///ge; consumes PL_tmps_stack in its loop
Message-Id: <20050830160113.9716.HIO@ymir.co.jp>

p4raw-id: //depot/perl@26334

pp_ctl.c

index b49a5b5..401f60f 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -207,6 +207,7 @@ PP(pp_substcont)
        if (!(cx->sb_rxtainted & 2) && SvTAINTED(TOPs))
            cx->sb_rxtainted |= 2;
        sv_catsv(dstr, POPs);
+       FREETMPS; /* Prevent excess tmp stack */
 
        /* Are we done */
        if (cx->sb_once || !CALLREGEXEC(aTHX_ rx, s, cx->sb_strend, orig,