From: gfx Date: Sat, 5 Sep 2009 07:26:42 +0000 (+0900) Subject: newSVpvn_flags() does mortalization in place, instead of calling sv_2mortal() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6dfeccca7d595e9c94766acdd058cec56fa67315;p=p5sagit%2Fp5-mst-13.2.git newSVpvn_flags() does mortalization in place, instead of calling sv_2mortal() Signed-off-by: Yves Orton --- diff --git a/sv.c b/sv.c index a53669a..cf9a6ff 100644 --- a/sv.c +++ b/sv.c @@ -7582,8 +7582,14 @@ 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); - SvFLAGS(sv) |= (flags & SVf_UTF8); - return (flags & SVs_TEMP) ? sv_2mortal(sv) : sv; + SvFLAGS(sv) |= flags; + + if(flags & SVs_TEMP){ + EXTEND_MORTAL(1); + PL_tmps_stack[++PL_tmps_ix] = sv; + } + + return sv; } /*