From: Chip Salzenberg Date: Tue, 1 Apr 1997 00:01:35 +0000 (+1200) Subject: Reduce memory footprint of literal strings X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1c9c84dfb2f3bf591c8f571b0d9c0e803b8609af;p=p5sagit%2Fp5-mst-13.2.git Reduce memory footprint of literal strings (this is the same change as commit 1bd69d1d0fa002def016e601cb71bfcd93600bd3, but as applied) --- diff --git a/toke.c b/toke.c index b96e23e..724c214 100644 --- a/toke.c +++ b/toke.c @@ -622,7 +622,11 @@ sublex_start() return THING; } if (op_type == OP_CONST || op_type == OP_READLINE) { - yylval.opval = (OP*)newSVOP(op_type, 0, q(lex_stuff)); + SV *sv = q(lex_stuff); + STRLEN len; + char *p = SvPV(sv, len); + yylval.opval = (OP*)newSVOP(op_type, 0, newSVpv(p, len)); + SvREFCNT_dec(sv); lex_stuff = Nullsv; return THING; }