summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-12-17 23:22:31 +0000
committerNicholas Clark <nick@ccl4.org>2005-12-17 23:22:31 +0000
commitf4b190e604dfeb3b326a17a85144eca8e832729d (patch)
tree1bb6a6cb2f606d57d0e5d1f455db20326b9fe040
parentff7df920e39ddd3df5ebcc5a06e803af9c883004 (diff)
downloadperl-f4b190e604dfeb3b326a17a85144eca8e832729d.tar.gz
Add some paranoia to check that GP accesses aren't being done on the
wrong types of SV. p4raw-id: //depot/perl@26395
-rw-r--r--gv.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/gv.h b/gv.h
index d9a5b51037..f1794943e4 100644
--- a/gv.h
+++ b/gv.h
@@ -24,7 +24,14 @@ struct gp {
#define GvXPVGV(gv) ((XPVGV*)SvANY(gv))
-#define GvGP(gv) (GvXPVGV(gv)->xgv_gp)
+#ifdef DEBUGGING
+# define GvGP(gv) (*(assert(SvTYPE(gv) == SVt_PVGV || \
+ SvTYPE(gv) == SVt_PVLV), \
+ &(GvXPVGV(gv)->xgv_gp)))
+#else
+# define GvGP(gv) (GvXPVGV(gv)->xgv_gp)
+#endif
+
#define GvNAME(gv) (GvXPVGV(gv)->xgv_name)
#define GvNAMELEN(gv) (GvXPVGV(gv)->xgv_namelen)
#define GvSTASH(gv) (GvXPVGV(gv)->xgv_stash)