summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdist/threads/threads.xs2
-rw-r--r--embed.fnc2
-rw-r--r--embed.h2
-rw-r--r--global.sym1
-rw-r--r--hv.c4
-rw-r--r--mro.c9
-rw-r--r--proto.h6
-rw-r--r--regcomp.c5
-rw-r--r--sv.c20
9 files changed, 33 insertions, 18 deletions
diff --git a/dist/threads/threads.xs b/dist/threads/threads.xs
index a5595959e4..c97b6ab735 100755
--- a/dist/threads/threads.xs
+++ b/dist/threads/threads.xs
@@ -792,7 +792,7 @@ S_ithread_create(
sv_copypv(thread->init_function, init_function);
} else {
thread->init_function =
- SvREFCNT_inc(sv_dup(init_function, &clone_param));
+ sv_dup_inc(init_function, &clone_param);
}
thread->params = params = newAV();
diff --git a/embed.fnc b/embed.fnc
index 1f2ecb93ad..6b3fd8f04f 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -1422,6 +1422,8 @@ s |SV ** |sv_dup_inc_multiple|NN SV *const *source|NN SV **dest \
|SSize_t items|NN CLONE_PARAMS *const param
#endif
ApR |SV* |sv_dup |NULLOK const SV *const sstr|NN CLONE_PARAMS *const param
+ApR |SV* |sv_dup_inc |NULLOK const SV *const sstr \
+ |NN CLONE_PARAMS *const param
Ap |void |rvpv_dup |NN SV *const dstr|NN const SV *const sstr|NN CLONE_PARAMS *const param
Ap |yy_parser*|parser_dup |NULLOK const yy_parser *const proto|NN CLONE_PARAMS *const param
#endif
diff --git a/embed.h b/embed.h
index 706bfe4cd0..02871f2419 100644
--- a/embed.h
+++ b/embed.h
@@ -1181,6 +1181,7 @@
#endif
#endif
#define sv_dup Perl_sv_dup
+#define sv_dup_inc Perl_sv_dup_inc
#define rvpv_dup Perl_rvpv_dup
#define parser_dup Perl_parser_dup
#endif
@@ -3590,6 +3591,7 @@
#endif
#endif
#define sv_dup(a,b) Perl_sv_dup(aTHX_ a,b)
+#define sv_dup_inc(a,b) Perl_sv_dup_inc(aTHX_ a,b)
#define rvpv_dup(a,b,c) Perl_rvpv_dup(aTHX_ a,b,c)
#define parser_dup(a,b) Perl_parser_dup(aTHX_ a,b)
#endif
diff --git a/global.sym b/global.sym
index 6cffeb819a..25e43c971a 100644
--- a/global.sym
+++ b/global.sym
@@ -726,6 +726,7 @@ Perl_dirp_dup
Perl_gp_dup
Perl_mg_dup
Perl_sv_dup
+Perl_sv_dup_inc
Perl_rvpv_dup
Perl_parser_dup
Perl_ptr_table_new
diff --git a/hv.c b/hv.c
index 1ff73b0c49..6d6edb2ae3 100644
--- a/hv.c
+++ b/hv.c
@@ -179,7 +179,7 @@ Perl_he_dup(pTHX_ const HE *e, bool shared, CLONE_PARAMS* param)
char *k;
Newx(k, HEK_BASESIZE + sizeof(const SV *), char);
HeKEY_hek(ret) = (HEK*)k;
- HeKEY_sv(ret) = SvREFCNT_inc(sv_dup(HeKEY_sv(e), param));
+ HeKEY_sv(ret) = sv_dup_inc(HeKEY_sv(e), param);
}
else if (shared) {
/* This is hek_dup inlined, which seems to be important for speed
@@ -202,7 +202,7 @@ Perl_he_dup(pTHX_ const HE *e, bool shared, CLONE_PARAMS* param)
else
HeKEY_hek(ret) = save_hek_flags(HeKEY(e), HeKLEN(e), HeHASH(e),
HeKFLAGS(e));
- HeVAL(ret) = SvREFCNT_inc(sv_dup(HeVAL(e), param));
+ HeVAL(ret) = sv_dup_inc(HeVAL(e), param);
return ret;
}
#endif /* USE_ITHREADS */
diff --git a/mro.c b/mro.c
index 2dca25cc82..488e564684 100644
--- a/mro.c
+++ b/mro.c
@@ -162,23 +162,22 @@ Perl_mro_meta_dup(pTHX_ struct mro_meta* smeta, CLONE_PARAMS* param)
if (newmeta->mro_linear_all) {
newmeta->mro_linear_all
- = MUTABLE_HV(SvREFCNT_inc(sv_dup((const SV *)newmeta->mro_linear_all, param)));
+ = MUTABLE_HV(sv_dup_inc((const SV *)newmeta->mro_linear_all, param));
/* This is just acting as a shortcut pointer, and will be automatically
updated on the first get. */
newmeta->mro_linear_current = NULL;
} else if (newmeta->mro_linear_current) {
/* Only the current MRO is stored, so this owns the data. */
newmeta->mro_linear_current
- = SvREFCNT_inc(sv_dup((const SV *)newmeta->mro_linear_current,
- param));
+ = sv_dup_inc((const SV *)newmeta->mro_linear_current, param);
}
if (newmeta->mro_nextmethod)
newmeta->mro_nextmethod
- = MUTABLE_HV(SvREFCNT_inc(sv_dup((const SV *)newmeta->mro_nextmethod, param)));
+ = MUTABLE_HV(sv_dup_inc((const SV *)newmeta->mro_nextmethod, param));
if (newmeta->isa)
newmeta->isa
- = MUTABLE_HV(SvREFCNT_inc(sv_dup((const SV *)newmeta->isa, param)));
+ = MUTABLE_HV(sv_dup_inc((const SV *)newmeta->isa, param));
return newmeta;
}
diff --git a/proto.h b/proto.h
index 8d4f283aea..fe487af5b1 100644
--- a/proto.h
+++ b/proto.h
@@ -4295,6 +4295,12 @@ PERL_CALLCONV SV* Perl_sv_dup(pTHX_ const SV *const sstr, CLONE_PARAMS *const pa
#define PERL_ARGS_ASSERT_SV_DUP \
assert(param)
+PERL_CALLCONV SV* Perl_sv_dup_inc(pTHX_ const SV *const sstr, CLONE_PARAMS *const param)
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_2);
+#define PERL_ARGS_ASSERT_SV_DUP_INC \
+ assert(param)
+
PERL_CALLCONV void Perl_rvpv_dup(pTHX_ SV *const dstr, const SV *const sstr, CLONE_PARAMS *const param)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2)
diff --git a/regcomp.c b/regcomp.c
index be5acdba56..c8c47e9c5b 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -9636,9 +9636,8 @@ Perl_regfree_internal(pTHX_ REGEXP * const rx)
Safefree(ri);
}
-#define sv_dup_inc(s,t) SvREFCNT_inc(sv_dup(s,t))
-#define av_dup_inc(s,t) MUTABLE_AV(SvREFCNT_inc(sv_dup((const SV *)s,t)))
-#define hv_dup_inc(s,t) MUTABLE_HV(SvREFCNT_inc(sv_dup((const SV *)s,t)))
+#define av_dup_inc(s,t) MUTABLE_AV(sv_dup_inc((const SV *)s,t))
+#define hv_dup_inc(s,t) MUTABLE_HV(sv_dup_inc((const SV *)s,t))
#define SAVEPVN(p,n) ((p) ? savepvn(p,n) : NULL)
/*
diff --git a/sv.c b/sv.c
index 044c8bd051..d0013edc60 100644
--- a/sv.c
+++ b/sv.c
@@ -10491,18 +10491,17 @@ ptr_table_* functions.
that currently av_dup, gv_dup and hv_dup are the same as sv_dup.
If this changes, please unmerge ss_dup.
Likewise, sv_dup_inc_multiple() relies on this fact. */
-#define sv_dup_inc(s,t) SvREFCNT_inc(sv_dup(s,t))
-#define sv_dup_inc_NN(s,t) SvREFCNT_inc_NN(sv_dup(s,t))
+#define sv_dup_inc_NN(s,t) SvREFCNT_inc_NN(sv_dup_inc(s,t))
#define av_dup(s,t) MUTABLE_AV(sv_dup((const SV *)s,t))
-#define av_dup_inc(s,t) MUTABLE_AV(SvREFCNT_inc(sv_dup((const SV *)s,t)))
+#define av_dup_inc(s,t) MUTABLE_AV(sv_dup_inc((const SV *)s,t))
#define hv_dup(s,t) MUTABLE_HV(sv_dup((const SV *)s,t))
-#define hv_dup_inc(s,t) MUTABLE_HV(SvREFCNT_inc(sv_dup((const SV *)s,t)))
+#define hv_dup_inc(s,t) MUTABLE_HV(sv_dup_inc((const SV *)s,t))
#define cv_dup(s,t) MUTABLE_CV(sv_dup((const SV *)s,t))
-#define cv_dup_inc(s,t) MUTABLE_CV(SvREFCNT_inc(sv_dup((const SV *)s,t)))
+#define cv_dup_inc(s,t) MUTABLE_CV(sv_dup_inc((const SV *)s,t))
#define io_dup(s,t) MUTABLE_IO(sv_dup((const SV *)s,t))
-#define io_dup_inc(s,t) MUTABLE_IO(SvREFCNT_inc(sv_dup((const SV *)s,t)))
+#define io_dup_inc(s,t) MUTABLE_IO(sv_dup_inc((const SV *)s,t))
#define gv_dup(s,t) MUTABLE_GV(sv_dup((const SV *)s,t))
-#define gv_dup_inc(s,t) MUTABLE_GV(SvREFCNT_inc(sv_dup((const SV *)s,t)))
+#define gv_dup_inc(s,t) MUTABLE_GV(sv_dup_inc((const SV *)s,t))
#define SAVEPV(p) ((p) ? savepv(p) : NULL)
#define SAVEPVN(p,n) ((p) ? savepvn(p,n) : NULL)
@@ -11352,6 +11351,13 @@ Perl_sv_dup(pTHX_ const SV *const sstr, CLONE_PARAMS *const param)
return dstr;
}
+SV *
+Perl_sv_dup_inc(pTHX_ const SV *const sstr, CLONE_PARAMS *const param)
+{
+ PERL_ARGS_ASSERT_SV_DUP_INC;
+ return SvREFCNT_inc(sv_dup(sstr,param));
+}
+
/* duplicate a context */
PERL_CONTEXT *