Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perlapi: Document sv_dup(_inc)? #19741

Merged
merged 1 commit into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions embed.fnc
Original file line number Diff line number Diff line change
Expand Up @@ -2829,8 +2829,8 @@ S |SV ** |sv_dup_inc_multiple|NN SV *const *source|NN SV **dest \
SR |SV* |sv_dup_common |NN const SV *const ssv \
|NN CLONE_PARAMS *const param
#endif
ApR |SV* |sv_dup |NULLOK const SV *const ssv|NN CLONE_PARAMS *const param
ApR |SV* |sv_dup_inc |NULLOK const SV *const ssv \
ApdR |SV* |sv_dup |NULLOK const SV *const ssv|NN CLONE_PARAMS *const param
ApdR |SV* |sv_dup_inc |NULLOK const SV *const ssv \
|NN CLONE_PARAMS *const param
Cp |void |rvpv_dup |NN SV *const dsv|NN const SV *const ssv|NN CLONE_PARAMS *const param
Cp |yy_parser*|parser_dup |NULLOK const yy_parser *const proto|NN CLONE_PARAMS *const param
Expand Down
21 changes: 21 additions & 0 deletions sv.c
Original file line number Diff line number Diff line change
Expand Up @@ -14590,6 +14590,27 @@ S_sv_dup_common(pTHX_ const SV *const ssv, CLONE_PARAMS *const param)
return dsv;
}

/*
=for apidoc sv_dup
=for apidoc_item sv_dup_inc

These duplicate an SV of any type (including AV, HV etc), returning a pointer
to the cloned object. The difference is that the new SV under C<sv_dup> has a
reference count of 0, but 1 under C<sv_dup_inc>. Only specialized cases will
want a zero reference count, almost certainly only when you aren't already
holding a reference. Thus, you almost always want to use the C<sv_dup_inc>
form.

C<param> has type S<C<CLONE_PARAMS *>>. This is mostly for internal core use
when duplicating something more complicated than an SV (code in common is
used). Your code may inherit this parameter, which you merely pass on, but you
can initialize it by using L</C<clone_params_new>>. Don't forget to free it
when done, via L</C<clone_params_del>>. Its only member that is public is
C<flags>, all which are documented in L</C<perl_clone>>.

=cut
*/

SV *
Perl_sv_dup_inc(pTHX_ const SV *const ssv, CLONE_PARAMS *const param)
{
Expand Down