summaryrefslogtreecommitdiff
path: root/sv.h
diff options
context:
space:
mode:
Diffstat (limited to 'sv.h')
-rw-r--r--sv.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/sv.h b/sv.h
index 37b79c96bf..8e2417cc7d 100644
--- a/sv.h
+++ b/sv.h
@@ -1441,6 +1441,20 @@ the scalar's value cannot change unless written to.
} \
} STMT_END
+#ifdef PERL_CORE
+/* Code that crops up in three places to take a scalar and ready it to hold
+ a reference */
+# define prepare_SV_for_RV(sv) \
+ STMT_START { \
+ if (SvTYPE(sv) < SVt_PV && SvTYPE(sv) != SVt_IV) \
+ sv_upgrade(sv, SVt_IV); \
+ else if (SvPVX_const(sv)) { \
+ SvPV_free(sv); \
+ SvLEN_set(sv, 0); \
+ SvCUR_set(sv, 0); \
+ } \
+ } STMT_END
+#endif
#define PERL_FBM_TABLE_OFFSET 1 /* Number of bytes between EOS and table */