From 59cd0e26eb6c10499b25d783562357dd68cc16f2 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Thu, 3 Jan 2008 17:15:53 +0000 Subject: Extend newSVpvn_flags() to also call sv_2mortal() if SVs_TEMP is set in the flags. Move its implementation just ahead of sv_2mortal()'s for CPU cache locality. Refactor all code that can be to use this. p4raw-id: //depot/perl@32818 --- pp_pack.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pp_pack.c') diff --git a/pp_pack.c b/pp_pack.c index 0d456bd569..21e6494d2f 100644 --- a/pp_pack.c +++ b/pp_pack.c @@ -2010,7 +2010,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c SHIFT_VAR(utf8, s, strend, aptr, datumtype); DO_BO_UNPACK_PC(aptr); /* newSVpvn generates undef if aptr is NULL */ - PUSHs(sv_2mortal(newSVpvn(aptr, len))); + PUSHs(newSVpvn_flags(aptr, len, SVs_TEMP)); } break; #ifdef HAS_QUAD @@ -2511,8 +2511,8 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) STRLEN len; const char *const pv = SvPV_const(*beglist, len); SV *const temp - = sv_2mortal(newSVpvn_flags(pv, len, - SvUTF8(*beglist))); + = newSVpvn_flags(pv, len, + SVs_TEMP | SvUTF8(*beglist)); *beglist = temp; } count = DO_UTF8(*beglist) ? -- cgit v1.2.1