summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2009-09-05 13:23:01 +0200
committerYves Orton <demerphq@gmail.com>2009-09-05 13:23:01 +0200
commitd21488d70bf398a35564d13cdc9d7ec951f35f9d (patch)
tree2e3237c1cf4d38a227d6f9948cebd1353fdceb92 /sv.c
parent46ca9baca57195cba6c2018437d0622aab45fe78 (diff)
downloadperl-d21488d70bf398a35564d13cdc9d7ec951f35f9d.tar.gz
add a note about the previous patches from gfx
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sv.c b/sv.c
index cf9a6ffe80..be616ea116 100644
--- a/sv.c
+++ b/sv.c
@@ -7582,6 +7582,15 @@ Perl_newSVpvn_flags(pTHX_ const char *const s, const STRLEN len, const U32 flags
assert(!(flags & ~(SVf_UTF8|SVs_TEMP)));
new_SV(sv);
sv_setpvn(sv,s,len);
+
+ /* This code used to a sv_2mortal(), however we now unroll the call to sv_2mortal()
+ * and do what it does outselves here.
+ * Since we have asserted that flags can only have the SVf_UTF8 and/or SVs_TEMP flags
+ * set above we can use it to enable the sv flags directly (bypassing SvTEMP_on), which
+ * in turn means we dont need to mask out the SVf_UTF8 flag below, which means that we
+ * eleminate quite a few steps than it looks - Yves (explaining patch by gfx)
+ */
+
SvFLAGS(sv) |= flags;
if(flags & SVs_TEMP){
@@ -7612,6 +7621,9 @@ Perl_sv_2mortal(pTHX_ register SV *const sv)
return NULL;
if (SvREADONLY(sv) && SvIMMORTAL(sv))
return sv;
+ /* Note if you change this you must ALSO change
+ * newSVpvn_flags() which defined immediately above this routine
+ */
EXTEND_MORTAL(1);
PL_tmps_stack[++PL_tmps_ix] = sv;
SvTEMP_on(sv);