summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-01-13 23:13:05 +0000
committerNicholas Clark <nick@ccl4.org>2005-01-13 23:13:05 +0000
commite90aabebafdd77f6f0dc6cf0b24db209e9442e31 (patch)
treeb6f24e14cad5322e2487c6749cbbc64fdee9a413 /sv.c
parent243b1711e6dba4a348cef9fff90e6aa6a8a4d0ea (diff)
downloadperl-e90aabebafdd77f6f0dc6cf0b24db209e9442e31.tar.gz
Use the new SV_NOSTEAL flag to avoid the SvTEMP dance in newSVsv
p4raw-id: //depot/perl@23797
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sv.c b/sv.c
index b1edb2fc62..e9e0eca865 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;
}