summaryrefslogtreecommitdiff
path: root/cv.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-10-27 21:43:01 +0000
committerNicholas Clark <nick@ccl4.org>2008-10-27 21:43:01 +0000
commit8f629a87fe8f340f7e1d3258b7972985953c03fc (patch)
tree7079e335067e52d1040e411696f4743270b3a832 /cv.h
parent4a4ab19ce26e87d2090eef975921267c418d3b87 (diff)
downloadperl-8f629a87fe8f340f7e1d3258b7972985953c03fc.tar.gz
Convert all (CV *) casts to (const CV *). Convert (XPVCV*) casts to add
MUTABLE_PTR(), to validate that there is no casting away of const. p4raw-id: //depot/perl@34610
Diffstat (limited to 'cv.h')
-rw-r--r--cv.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/cv.h b/cv.h
index b5a903a3f1..bd504fd3b1 100644
--- a/cv.h
+++ b/cv.h
@@ -42,13 +42,13 @@ Returns the stash of the CV.
# define Nullcv Null(CV*)
#endif
-#define CvSTASH(sv) ((XPVCV*)SvANY(sv))->xcv_stash
-#define CvSTART(sv) ((XPVCV*)SvANY(sv))->xcv_start_u.xcv_start
-#define CvROOT(sv) ((XPVCV*)SvANY(sv))->xcv_root_u.xcv_root
-#define CvXSUB(sv) ((XPVCV*)SvANY(sv))->xcv_root_u.xcv_xsub
-#define CvXSUBANY(sv) ((XPVCV*)SvANY(sv))->xcv_start_u.xcv_xsubany
-#define CvGV(sv) ((XPVCV*)SvANY(sv))->xcv_gv
-#define CvFILE(sv) ((XPVCV*)SvANY(sv))->xcv_file
+#define CvSTASH(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_stash
+#define CvSTART(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_start_u.xcv_start
+#define CvROOT(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_root_u.xcv_root
+#define CvXSUB(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_root_u.xcv_xsub
+#define CvXSUBANY(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_start_u.xcv_xsubany
+#define CvGV(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_gv
+#define CvFILE(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_file
#ifdef USE_ITHREADS
# define CvFILE_set_from_cop(sv, cop) (CvFILE(sv) = savepv(CopFILE(cop)))
#else
@@ -56,17 +56,17 @@ Returns the stash of the CV.
#endif
#define CvFILEGV(sv) (gv_fetchfile(CvFILE(sv)))
#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
-# define CvDEPTH(sv) (*({const CV *_cvdepth = (CV *)sv; \
+# define CvDEPTH(sv) (*({const CV *const _cvdepth = (const CV *)sv; \
assert(SvTYPE(_cvdepth) == SVt_PVCV); \
&((XPVCV*)SvANY(_cvdepth))->xiv_u.xivu_i32; \
}))
#else
-# define CvDEPTH(sv) ((XPVCV*)SvANY(sv))->xiv_u.xivu_i32
+# define CvDEPTH(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xiv_u.xivu_i32
#endif
-#define CvPADLIST(sv) ((XPVCV*)SvANY(sv))->xcv_padlist
-#define CvOUTSIDE(sv) ((XPVCV*)SvANY(sv))->xcv_outside
-#define CvFLAGS(sv) ((XPVCV*)SvANY(sv))->xcv_flags
-#define CvOUTSIDE_SEQ(sv) ((XPVCV*)SvANY(sv))->xcv_outside_seq
+#define CvPADLIST(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist
+#define CvOUTSIDE(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_outside
+#define CvFLAGS(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_flags
+#define CvOUTSIDE_SEQ(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_outside_seq
#define CVf_METHOD 0x0001 /* CV is explicitly marked as a method */
#define CVf_LOCKED 0x0002 /* CV locks itself or first arg on entry */