summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Leach <richardleach@users.noreply.github.com>2022-07-20 21:38:57 +0000
committerRichard Leach <richardleach@users.noreply.github.com>2022-09-17 23:02:40 +0100
commit33498ed6ab04d6249c8585950bfd9321db9d2fa7 (patch)
treeb02604a9379d4510d52292df1d731d701fac5670
parente05fbdc05a0939b5cd888a582885fa4f74883f51 (diff)
downloadperl-33498ed6ab04d6249c8585950bfd9321db9d2fa7.tar.gz
sv_setsv_cow - directly create desired SVt_COW SV
It's more efficient to directly create the desired SV type than create a SVt_NULL and then call sv_upgrade to get the desired type.
-rw-r--r--sv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sv.c b/sv.c
index 538944dfb3..7fe093e1c6 100644
--- a/sv.c
+++ b/sv.c
@@ -4783,10 +4783,10 @@ Perl_sv_setsv_cow(pTHX_ SV *dsv, SV *ssv)
sv_force_normal_flags(dsv, SV_COW_DROP_PV);
else if (SvPVX_const(dsv))
Safefree(SvPVX_mutable(dsv));
+ SvUPGRADE(dsv, SVt_COW);
}
else
- new_SV(dsv);
- SvUPGRADE(dsv, SVt_COW);
+ dsv = newSV_type(SVt_COW);
assert (SvPOK(ssv));
assert (SvPOKp(ssv));