summaryrefslogtreecommitdiff
path: root/pp_pack.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-01-03 17:15:53 +0000
committerNicholas Clark <nick@ccl4.org>2008-01-03 17:15:53 +0000
commit59cd0e26eb6c10499b25d783562357dd68cc16f2 (patch)
tree68198e7261586c25728270515fa4f9f3acd7735c /pp_pack.c
parentd16d613cbabd929abf5d13edb895c38c5a99bc29 (diff)
downloadperl-59cd0e26eb6c10499b25d783562357dd68cc16f2.tar.gz
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
Diffstat (limited to 'pp_pack.c')
-rw-r--r--pp_pack.c6
1 files changed, 3 insertions, 3 deletions
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) ?