STATIC SV *vmg_clone(pTHX_ SV *sv, tTHX owner) {
#define vmg_clone(P, O) vmg_clone(aTHX_ (P), (O))
+ SV *dupsv;
+
+#if VMG_HAS_PERL(5, 13, 2)
+ CLONE_PARAMS *param = Perl_clone_params_new(owner, aTHX);
+
+ dupsv = sv_dup(sv, param);
+
+ Perl_clone_params_del(param);
+#else
CLONE_PARAMS param;
param.stashes = NULL; /* don't need it unless sv is a PVHV */
param.flags = 0;
param.proto_perl = owner;
- return SvREFCNT_inc(sv_dup(sv, ¶m));
+ dupsv = sv_dup(sv, ¶m);
+#endif
+
+ return SvREFCNT_inc(dupsv);
}
#endif /* VMG_THREADSAFE */