This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Revert "postpone perl_parse() exit(0) bugfix"
[perl5.git] / sv_inline.h
index e0615e4..5743348 100644 (file)
@@ -850,6 +850,30 @@ S_sv_or_pv_pos_u2b(pTHX_ SV *sv, const char *pv, STRLEN pos, STRLEN *lenp)
 #endif
 
 PERL_STATIC_INLINE char *
+Perl_sv_pvutf8n_force_wrapper(pTHX_ SV * const sv, STRLEN * const lp, const U32 dummy)
+{
+    /* This is just so can be passed to Perl_SvPV_helper() as a function
+     * pointer with the same signature as all the other such pointers, and
+     * having hence an unused parameter */
+    PERL_ARGS_ASSERT_SV_PVUTF8N_FORCE_WRAPPER;
+    PERL_UNUSED_ARG(dummy);
+
+    return sv_pvutf8n_force(sv, lp);
+}
+
+PERL_STATIC_INLINE char *
+Perl_sv_pvbyten_force_wrapper(pTHX_ SV * const sv, STRLEN * const lp, const U32 dummy)
+{
+    /* This is just so can be passed to Perl_SvPV_helper() as a function
+     * pointer with the same signature as all the other such pointers, and
+     * having hence an unused parameter */
+    PERL_ARGS_ASSERT_SV_PVBYTEN_FORCE_WRAPPER;
+    PERL_UNUSED_ARG(dummy);
+
+    return sv_pvbyten_force(sv, lp);
+}
+
+PERL_STATIC_INLINE char *
 Perl_SvPV_helper(pTHX_
                  SV * const sv,
                  STRLEN * const lp,
@@ -904,28 +928,29 @@ Perl_SvPV_helper(pTHX_
     return non_trivial(aTHX_ sv, lp, (flags|return_flags));
 }
 
-PERL_STATIC_INLINE char *
-Perl_sv_pvutf8n_force_wrapper(pTHX_ SV * const sv, STRLEN * const lp, const U32 dummy)
-{
-    /* This is just so can be passed to Perl_SvPV_helper() as a function
-     * pointer with the same signature as all the other such pointers, and
-     * having hence an unused parameter */
-    PERL_ARGS_ASSERT_SV_PVUTF8N_FORCE_WRAPPER;
-    PERL_UNUSED_ARG(dummy);
+/*
+=for apidoc newRV_noinc
 
-    return sv_pvutf8n_force(sv, lp);
-}
+Creates an RV wrapper for an SV.  The reference count for the original
+SV is B<not> incremented.
 
-PERL_STATIC_INLINE char *
-Perl_sv_pvbyten_force_wrapper(pTHX_ SV * const sv, STRLEN * const lp, const U32 dummy)
+=cut
+*/
+
+PERL_STATIC_INLINE SV *
+Perl_newRV_noinc(pTHX_ SV *const tmpRef)
 {
-    /* This is just so can be passed to Perl_SvPV_helper() as a function
-     * pointer with the same signature as all the other such pointers, and
-     * having hence an unused parameter */
-    PERL_ARGS_ASSERT_SV_PVBYTEN_FORCE_WRAPPER;
-    PERL_UNUSED_ARG(dummy);
+    SV *sv = newSV_type(SVt_IV);
 
-    return sv_pvbyten_force(sv, lp);
+    PERL_ARGS_ASSERT_NEWRV_NOINC;
+
+    SvTEMP_off(tmpRef);
+
+    /* inlined, simplified sv_setrv_noinc(sv, tmpRef); */
+    SvRV_set(sv, tmpRef);
+    SvROK_on(sv);
+
+    return sv;
 }
 
 /*