Move Perl_newSVsv_flags to sv_inline.h

Perl_newSVsv_flags has become just a stub around Perl_newSVsv_flags_NN.
For callers where the source SV* is NULL, not having to call a
function in sv.c to immediately return is very desirable.
This commit is contained in:
Richard Leach 2025-06-02 10:17:29 +00:00
parent 79b32d926e
commit 0dfa8ac113
4 changed files with 31 additions and 29 deletions

View File

@ -2358,7 +2358,7 @@ ARdp |OP * |newSVREF |NN OP *o
Adp |SV * |newSVrv |NN SV * const rv \
|NULLOK const char * const classname
ARdmp |SV * |newSVsv |NULLOK SV * const old
ARdp |SV * |newSVsv_flags |NULLOK SV * const old \
ARdip |SV * |newSVsv_flags |NULLOK SV * const old \
|I32 flags
ARdp |SV * |newSVsv_flags_NN \
|NN SV * const old \

9
proto.h generated
View File

@ -3121,10 +3121,6 @@ Perl_newSVsv(pTHX_ SV * const old)
__attribute__warn_unused_result__; */
PERL_CALLCONV SV *
Perl_newSVsv_flags(pTHX_ SV * const old, I32 flags)
__attribute__warn_unused_result__;
#define PERL_ARGS_ASSERT_NEWSVSV_FLAGS
Perl_newSVsv_flags_NN(pTHX_ SV * const old, I32 flags)
__attribute__warn_unused_result__;
#define PERL_ARGS_ASSERT_NEWSVSV_FLAGS_NN \
@ -10025,6 +10021,11 @@ Perl_newSV_type_mortal(pTHX_ const svtype type)
__attribute__always_inline__;
# define PERL_ARGS_ASSERT_NEWSV_TYPE_MORTAL
PERL_STATIC_INLINE SV *
Perl_newSVsv_flags(pTHX_ SV * const old, I32 flags)
__attribute__warn_unused_result__;
# define PERL_ARGS_ASSERT_NEWSVSV_FLAGS
PERL_STATIC_INLINE SV *
Perl_new_sv(pTHX_ const char *file, int line, const char *func);
# define PERL_ARGS_ASSERT_NEW_SV \

24
sv.c
View File

@ -10614,30 +10614,6 @@ Perl_newRV(pTHX_ SV *const sv)
return newRV_noinc(SvREFCNT_inc_simple_NN(sv));
}
/*
=for apidoc newSVsv
=for apidoc_item newSVsv_flags
=for apidoc_item newSVsv_nomg
These create a new SV which is an exact duplicate of the original SV
(using C<sv_setsv>.)
They differ only in that C<newSVsv> performs 'get' magic; C<newSVsv_nomg> skips
any magic; and C<newSVsv_flags> allows you to explicitly set a C<flags>
parameter.
=cut
*/
SV *
Perl_newSVsv_flags(pTHX_ SV *const old, I32 flags)
{
if (!old)
return NULL;
return newSVsv_flags_NN(old, flags);
}
/*
=for apidoc sv_reset

View File

@ -1005,5 +1005,30 @@ Perl_sv_setpv_freshbuf(pTHX_ SV *const sv)
return SvPVX(sv);
}
/*
=for apidoc newSVsv
=for apidoc_item newSVsv_flags
=for apidoc_item newSVsv_nomg
These create a new SV which is an exact duplicate of the original SV
(using C<newSVsv_flags_NN>.)
They differ only in that C<newSVsv> performs 'get' magic; C<newSVsv_nomg> skips
any magic; and C<newSVsv_flags> allows you to explicitly set a C<flags>
parameter.
=cut
*/
PERL_STATIC_INLINE SV *
Perl_newSVsv_flags(pTHX_ SV *const old, I32 flags)
{
if (!old)
return NULL;
return newSVsv_flags_NN(old, flags);
}
/*
* ex: set ts=8 sts=4 sw=4 et:
*/