diff options
author | Richard Leach <richardleach@users.noreply.github.com> | 2021-05-24 00:33:36 +0100 |
---|---|---|
committer | xenu <me@xenu.pl> | 2022-03-20 22:14:09 +0100 |
commit | b944b7ba26833a5a2716dc6cc2542a994ff63c2c (patch) | |
tree | 3edb7385263b4b2f7b4857d5f519725e436f50de /sv.c | |
parent | a933fcc5f0f338b86c0f40d0e43389770419ed70 (diff) | |
download | perl-b944b7ba26833a5a2716dc6cc2542a994ff63c2c.tar.gz |
Perl_newSVnv: simplify SV creation and SvNV_set
The function can be simplified by using the now-inlined newSV_type
function, directly using SvNV_set, and twiddling the required flags.
This cuts out any function call overhead, a switch statement leading
to a sv_upgrade(sv, SVt_NV) call, and a touch more bit-twiddling than
is necessary.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -9666,10 +9666,12 @@ The reference count for the SV is set to 1. SV * Perl_newSVnv(pTHX_ const NV n) { - SV *sv; + SV *sv = newSV_type(SVt_NV); + (void)SvNOK_on(sv); + + SvNV_set(sv, n); + SvTAINT(sv); - new_SV(sv); - sv_setnv(sv,n); return sv; } |