@@ -15054,6 +15054,35 @@ S_sv_dup_common(pTHX_ const SV *const ssv, CLONE_PARAMS *const param)
15054
15054
return dsv;
15055
15055
}
15056
15056
15057
+ /*
15058
+ =for apidoc sv_dup
15059
+ =for apidoc_item sv_dup_inc
15060
+
15061
+ In spite of their generic names, these are very specialized functions mainly
15062
+ for use when cloning an interpreter instance. You are probably looking for
15063
+ L<perlapi/newSVsv>.
15064
+
15065
+ They duplicate an SV of any type (not just a plain SV, but including AV, HV
15066
+ I<etc>.), returning a pointer to the cloned object. The difference is that the
15067
+ new SV under C<sv_dup> has a reference count of 0, but 1 under C<sv_dup_inc>.
15068
+ Only specialized cases will want a zero reference count, almost certainly only
15069
+ when you aren't already holding a reference. Thus, you almost always want to
15070
+ use the C<sv_dup_inc> form.
15071
+
15072
+ The cloning process uses use a cache, so that if a particular SV address has
15073
+ already been duped, that duped SV is returned again rather than creating a
15074
+ second duplicate.
15075
+
15076
+ C<param> has type S<C<CLONE_PARAMS *>>. This is mostly for internal core use
15077
+ when duplicating something more complicated than an SV (code in common is
15078
+ used). Your code may inherit this parameter, which you merely pass on, but you
15079
+ can initialize it by using C<clone_params_new>. Don't forget to
15080
+ free it when done, via C<clone_params_del>>. Its only member that is
15081
+ public is C<flags>, all which are documented in L<perlapi/perl_clone>.
15082
+
15083
+ =cut
15084
+ */
15085
+
15057
15086
SV *
15058
15087
Perl_sv_dup_inc(pTHX_ const SV *const ssv, CLONE_PARAMS *const param)
15059
15088
{
0 commit comments