From: Nicholas Clark Date: Sun, 5 Oct 2008 21:51:54 +0000 (+0000) Subject: Avoid allocating 1 extra regnode when duplicating a regexp. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=45cf45700e1f870b69e32588ff8b7583510f7b6b;p=p5sagit%2Fp5-mst-13.2.git Avoid allocating 1 extra regnode when duplicating a regexp. See http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2008-09/msg00590.html and http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2008-10/msg00163.html p4raw-id: //depot/perl@34464 --- diff --git a/regcomp.c b/regcomp.c index d2567d0..54347cc 100644 --- a/regcomp.c +++ b/regcomp.c @@ -9625,7 +9625,7 @@ Perl_regdupe_internal(pTHX_ REGEXP * const rx, CLONE_PARAMS *param) npar = r->nparens+1; len = ProgLen(ri); - Newxc(reti, sizeof(regexp_internal) + (len+1)*sizeof(regnode), char, regexp_internal); + Newxc(reti, sizeof(regexp_internal) + len*sizeof(regnode), char, regexp_internal); Copy(ri->program, reti->program, len+1, regnode);