From: Nicholas Clark Date: Sat, 17 Dec 2005 23:22:31 +0000 (+0000) Subject: Add some paranoia to check that GP accesses aren't being done on the X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f4b190e604dfeb3b326a17a85144eca8e832729d;p=p5sagit%2Fp5-mst-13.2.git Add some paranoia to check that GP accesses aren't being done on the wrong types of SV. p4raw-id: //depot/perl@26395 --- diff --git a/gv.h b/gv.h index d9a5b51..f179494 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)