summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2023-03-16 18:40:35 +0100
committerYves Orton <demerphq@gmail.com>2023-03-18 20:57:59 +0800
commit6dd040ff2f6f01a817731d112756188ddb541a18 (patch)
treea78475aea0b7c8ea6e0e05afd8a11db1ea6a2823 /proto.h
parente2e830cd93e16aedc6c6225069eeb7bdfc431a43 (diff)
downloadperl-6dd040ff2f6f01a817731d112756188ddb541a18.tar.gz
sv.h - add SvREFCNT_dec_set_NULL()
and also SvREFCNT_dec_ret_NULL() which is used to implement SvREFCNT_dec_set_NULL(). The set_NULL() macro is intended to be used to replace code like this: if (sv) { SvREFCNT_dec_NN(sv); sv = NULL; } The function form just facilitates it, and can be used in situations where returning NULL after decrementing a refcount would be reduce code complexity.
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/proto.h b/proto.h
index 5df8193a97..eedd5e36a2 100644
--- a/proto.h
+++ b/proto.h
@@ -76,6 +76,10 @@ Perl_Slab_Free(pTHX_ void *op);
#define PERL_ARGS_ASSERT_SLAB_FREE \
assert(op)
+/* PERL_CALLCONV void
+SvREFCNT_dec_set_NULL(pTHX_ SV *sv); */
+#define PERL_ARGS_ASSERT_SVREFCNT_DEC_SET_NULL
+
PERL_CALLCONV char *
Perl__byte_dump_string(pTHX_ const U8 * const start, const STRLEN len, const bool format);
#define PERL_ARGS_ASSERT__BYTE_DUMP_STRING \
@@ -9643,6 +9647,10 @@ Perl_SvREFCNT_dec_NN(pTHX_ SV *sv);
assert(sv)
PERL_STATIC_INLINE SV *
+Perl_SvREFCNT_dec_ret_NULL(pTHX_ SV *sv);
+# define PERL_ARGS_ASSERT_SVREFCNT_DEC_RET_NULL
+
+PERL_STATIC_INLINE SV *
Perl_SvREFCNT_inc(SV *sv);
# define PERL_ARGS_ASSERT_SVREFCNT_INC