From e90aabebafdd77f6f0dc6cf0b24db209e9442e31 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Thu, 13 Jan 2005 23:13:05 +0000 Subject: [PATCH] Use the new SV_NOSTEAL flag to avoid the SvTEMP dance in newSVsv p4raw-id: //depot/perl@23797 --- sv.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sv.c b/sv.c index b1edb2f..e9e0eca 100644 --- a/sv.c +++ b/sv.c @@ -7858,13 +7858,10 @@ Perl_newSVsv(pTHX_ register SV *old) return Nullsv; } new_SV(sv); - if (SvTEMP(old)) { - SvTEMP_off(old); - sv_setsv(sv,old); - SvTEMP_on(old); - } - else - sv_setsv(sv,old); + /* SV_GMAGIC is the default for sv_setv() + SV_NOSTEAL prevents TEMP buffers being, well, stolen, and saves games + with SvTEMP_off and SvTEMP_on round a call to sv_setsv. */ + sv_setsv_flags(sv, old, SV_GMAGIC | SV_NOSTEAL); return sv; } -- 2.7.4