summaryrefslogtreecommitdiff
path: root/sv_inline.h
diff options
context:
space:
mode:
Diffstat (limited to 'sv_inline.h')
-rw-r--r--sv_inline.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/sv_inline.h b/sv_inline.h
index c92bff366a..574334881c 100644
--- a/sv_inline.h
+++ b/sv_inline.h
@@ -929,5 +929,30 @@ Perl_SvPV_helper(pTHX_
}
/*
+=for apidoc newRV_noinc
+
+Creates an RV wrapper for an SV. The reference count for the original
+SV is B<not> incremented.
+
+=cut
+*/
+
+PERL_STATIC_INLINE SV *
+Perl_newRV_noinc(pTHX_ SV *const tmpRef)
+{
+ SV *sv = newSV_type(SVt_IV);
+
+ PERL_ARGS_ASSERT_NEWRV_NOINC;
+
+ SvTEMP_off(tmpRef);
+
+ /* inlined, simplified sv_setrv_noinc(sv, tmpRef); */
+ SvRV_set(sv, tmpRef);
+ SvROK_on(sv);
+
+ return sv;
+}
+
+/*
* ex: set ts=8 sts=4 sw=4 et:
*/