@@ -14968,6 +14968,35 @@ S_sv_dup_common(pTHX_ const SV *const ssv, CLONE_PARAMS *const param)
14968
14968
return dsv;
14969
14969
}
14970
14970
14971
+ /*
14972
+ =for apidoc sv_dup
14973
+ =for apidoc_item sv_dup_inc
14974
+
14975
+ In spite of their generic names, these are very specialized functions mainly
14976
+ for use when cloning an interpreter instance. You are probably looking for
14977
+ L<perlapi/newSVsv>.
14978
+
14979
+ They duplicate an SV of any type (not just a plain SV, but including AV, HV
14980
+ I<etc>.), returning a pointer to the cloned object. The difference is that the
14981
+ new SV under C<sv_dup> has a reference count of 0, but 1 under C<sv_dup_inc>.
14982
+ Only specialized cases will want a zero reference count, almost certainly only
14983
+ when you aren't already holding a reference. Thus, you almost always want to
14984
+ use the C<sv_dup_inc> form.
14985
+
14986
+ The cloning process uses a cache, so that if a particular SV address has
14987
+ already been duped, that duped SV is returned again rather than creating a
14988
+ second duplicate.
14989
+
14990
+ C<param> has type S<C<CLONE_PARAMS *>>. This is mostly for internal core use
14991
+ when duplicating something more complicated than an SV (code in common is
14992
+ used). Your code may inherit this parameter, which you merely pass on, but you
14993
+ can initialize it by using C<clone_params_new>. Don't forget to
14994
+ free it when done, via C<clone_params_del>>. Its only member that is
14995
+ public is C<flags>, all which are documented in L<perlapi/perl_clone>.
14996
+
14997
+ =cut
14998
+ */
14999
+
14971
15000
SV *
14972
15001
Perl_sv_dup_inc(pTHX_ const SV *const ssv, CLONE_PARAMS *const param)
14973
15002
{
0 commit comments