summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-06-17 15:19:07 +0200
committerNicholas Clark <nick@ccl4.org>2011-06-17 15:19:07 +0200
commit815dd406a7217429564c39cb160845d317b6da75 (patch)
treed8a5ce5635f3e27f42dc0656d3555ce229eb84aa /pp_hot.c
parent901b3fdb9d4a72eb844c8561169882a5ffa0d014 (diff)
downloadperl-815dd406a7217429564c39cb160845d317b6da75.tar.gz
In pp_subst, use a mortal scalar for dstr, instead of SAVEFREESV().
Creation of the mortal can be done with newSVpvn_flags(), saving 1 function call. Also, the mortal stack uses 1 pointer, whereas the save stack will use 2. It doesn't matter that dstr is now marked SVs_TEMP, as both code paths already gut it, stealing its SvPVX(). The SV head will happen to last a bit longer now, to the next FREETMPS, instead of the the scope pop at the end of pp_subst or pp_substcont.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/pp_hot.c b/pp_hot.c
index b2970d88c6..1b1117e05f 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2437,8 +2437,7 @@ PP(pp_subst)
#endif
if (RX_MATCH_TAINTED(rx)) /* run time pattern taint, eg locale */
rxtainted |= SUBST_TAINT_PAT;
- dstr = newSVpvn_utf8(m, s-m, DO_UTF8(TARG));
- SAVEFREESV(dstr);
+ dstr = newSVpvn_flags(m, s-m, SVs_TEMP | (DO_UTF8(TARG) ? SVf_UTF8 : 0));
PL_curpm = pm;
if (!c) {
register PERL_CONTEXT *cx;