summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChip Salzenberg <chip@atlantic.net>1997-04-01 12:01:35 +1200
committerChip Salzenberg <chip@atlantic.net>1997-04-01 12:01:35 +1200
commit1c9c84dfb2f3bf591c8f571b0d9c0e803b8609af (patch)
tree1212549e2cf7eedf9c37c0ef5fcfaf3f884bf7a4
parentc9d716f75179fb7a413359cd6453141dfe552e82 (diff)
downloadperl-1c9c84dfb2f3bf591c8f571b0d9c0e803b8609af.tar.gz
Reduce memory footprint of literal strings
(this is the same change as commit 1bd69d1d0fa002def016e601cb71bfcd93600bd3, but as applied)
-rw-r--r--toke.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/toke.c b/toke.c
index b96e23ea77..724c214722 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;
}