diff options
author | Yves Orton <demerphq@gmail.com> | 2009-09-05 13:23:01 +0200 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2009-09-05 13:23:01 +0200 |
commit | d21488d70bf398a35564d13cdc9d7ec951f35f9d (patch) | |
tree | 2e3237c1cf4d38a227d6f9948cebd1353fdceb92 /sv.c | |
parent | 46ca9baca57195cba6c2018437d0622aab45fe78 (diff) | |
download | perl-d21488d70bf398a35564d13cdc9d7ec951f35f9d.tar.gz |
add a note about the previous patches from gfx
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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); |