summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2021-08-22 19:42:15 +0100
committerPaul Evans <leonerd@leonerd.org.uk>2021-08-25 19:57:49 +0100
commit11d028376675b37f3e9c5f15bc93ab00562a25d1 (patch)
treebd771b42ae3ba25ec964246c376e0dfa8ed61825
parent7c2d42a7fc929320cd3f6fa97291ee8853fab689 (diff)
downloadperl-11d028376675b37f3e9c5f15bc93ab00562a25d1.tar.gz
Add sv_setrv_inc()
-rw-r--r--embed.fnc1
-rw-r--r--embed.h1
-rw-r--r--proto.h3
-rw-r--r--sv.c16
4 files changed, 21 insertions, 0 deletions
diff --git a/embed.fnc b/embed.fnc
index 344f0f4691..53d1b16276 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -1926,6 +1926,7 @@ Apd |void |sv_setpvn |NN SV *const sv|NULLOK const char *const ptr|const STRLEN
Apd |char *|sv_setpv_bufsize|NN SV *const sv|const STRLEN cur|const STRLEN len
Xp |void |sv_sethek |NN SV *const sv|NULLOK const HEK *const hek
Apd |void |sv_setrv_noinc |NN SV *const sv|NN SV *const ref
+Apd |void |sv_setrv_inc |NN SV *const sv|NN SV *const ref
ApMdb |void |sv_setsv |NN SV *dsv|NULLOK SV *ssv
CpMdb |void |sv_taint |NN SV* sv
CpdR |bool |sv_tainted |NN SV *const sv
diff --git a/embed.h b/embed.h
index 0b5ad16bf3..8ea033825e 100644
--- a/embed.h
+++ b/embed.h
@@ -695,6 +695,7 @@
#define sv_setref_pv(a,b,c) Perl_sv_setref_pv(aTHX_ a,b,c)
#define sv_setref_pvn(a,b,c,d) Perl_sv_setref_pvn(aTHX_ a,b,c,d)
#define sv_setref_uv(a,b,c) Perl_sv_setref_uv(aTHX_ a,b,c)
+#define sv_setrv_inc(a,b) Perl_sv_setrv_inc(aTHX_ a,b)
#define sv_setrv_noinc(a,b) Perl_sv_setrv_noinc(aTHX_ a,b)
#define sv_setsv_flags(a,b,c) Perl_sv_setsv_flags(aTHX_ a,b,c)
#define sv_setsv_mg(a,b) Perl_sv_setsv_mg(aTHX_ a,b)
diff --git a/proto.h b/proto.h
index 3c10bab6a7..0aaf882aeb 100644
--- a/proto.h
+++ b/proto.h
@@ -3814,6 +3814,9 @@ PERL_CALLCONV SV* Perl_sv_setref_pvn(pTHX_ SV *const rv, const char *const class
PERL_CALLCONV SV* Perl_sv_setref_uv(pTHX_ SV *const rv, const char *const classname, const UV uv);
#define PERL_ARGS_ASSERT_SV_SETREF_UV \
assert(rv)
+PERL_CALLCONV void Perl_sv_setrv_inc(pTHX_ SV *const sv, SV *const ref);
+#define PERL_ARGS_ASSERT_SV_SETRV_INC \
+ assert(sv); assert(ref)
PERL_CALLCONV void Perl_sv_setrv_noinc(pTHX_ SV *const sv, SV *const ref);
#define PERL_ARGS_ASSERT_SV_SETRV_NOINC \
assert(sv); assert(ref)
diff --git a/sv.c b/sv.c
index 42b243eb1a..04b6fbf398 100644
--- a/sv.c
+++ b/sv.c
@@ -1810,6 +1810,22 @@ Perl_sv_setrv_noinc(pTHX_ SV *const sv, SV *const ref)
SvROK_on(sv);
}
+/*
+=for apidoc sv_setrv_inc
+
+As C<sv_setrv_noinc> but increments the reference count of I<ref>.
+
+=cut
+*/
+
+void
+Perl_sv_setrv_inc(pTHX_ SV *const sv, SV *const ref)
+{
+ PERL_ARGS_ASSERT_SV_SETRV_INC;
+
+ sv_setrv_noinc(sv, SvREFCNT_inc_simple_NN(ref));
+}
+
/* Return a cleaned-up, printable version of sv, for non-numeric, or
* not incrementable warning display.
* Originally part of S_not_a_number().