summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorRichard Leach <richardleach@users.noreply.github.com>2022-08-02 22:12:58 +0000
committerKarl Williamson <khw@cpan.org>2022-08-05 13:53:23 -0600
commit819d09b57c6a76b0ba90670a1ea1861730bc457b (patch)
treefd512bb44f4974294eaf52be471beee71c5d1cfc /sv.c
parent36d1e5f3076514e5256e1424ae48d255572178a0 (diff)
downloadperl-819d09b57c6a76b0ba90670a1ea1861730bc457b.tar.gz
Perl_newRV_noinc - explicitly simplify, convert to inline func
Perl_newRV_noinc creates a new SVt_IV, then calls sv_setrv_noinc, which will check if the SVt_IV is SvTHINKFIRST (it won't be) and if it is types other than SVt_IV (it won't be). If those checks and associated branches are removed, all that remains is some flag twiddling and setting the sv_u.svu_rv pointer. A decent compiler *might* figure that all out and simplify Perl_newRV_noinc right down to the essentials, but if we do that directly, the entire function is small enough to move to sv_inline.h
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c33
1 files changed, 0 insertions, 33 deletions
diff --git a/sv.c b/sv.c
index 0fa165fc12..56d5c68ccf 100644
--- a/sv.c
+++ b/sv.c
@@ -9878,39 +9878,6 @@ Perl_newSV_false(pTHX)
return sv;
}
-/*
-=for apidoc newRV_noinc
-
-Creates an RV wrapper for an SV. The reference count for the original
-SV is B<not> incremented.
-
-=cut
-*/
-
-SV *
-Perl_newRV_noinc(pTHX_ SV *const tmpRef)
-{
- SV *sv;
-
- PERL_ARGS_ASSERT_NEWRV_NOINC;
-
- new_SV(sv);
-
- /* We're starting from SVt_FIRST, so provided that's
- * actual 0, we don't have to unset any SV type flags
- * to promote to SVt_IV. */
- STATIC_ASSERT_STMT(SVt_FIRST == 0);
-
- SET_SVANY_FOR_BODYLESS_IV(sv);
- SvFLAGS(sv) |= SVt_IV;
-
- SvTEMP_off(tmpRef);
-
- sv_setrv_noinc(sv, tmpRef);
-
- return sv;
-}
-
/* newRV_inc is the official function name to use now.
* newRV_inc is in fact #defined to newRV in sv.h
*/