cvsuser 05/03/18 05:40:13
Modified: include/parrot pobj.h
Log:
added PMC_ext_checked: it ensures that a PMC's ext is valid
Revision Changes Path
1.51 +10 -5 parrot/include/parrot/pobj.h
Index: pobj.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/pobj.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- pobj.h 27 Feb 2005 09:58:43 -0000 1.50
+++ pobj.h 18 Mar 2005 13:40:13 -0000 1.51
@@ -1,7 +1,7 @@
/* pobj.h
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: pobj.h,v 1.50 2005/02/27 09:58:43 leo Exp $
+ * $Id: pobj.h,v 1.51 2005/03/18 13:40:13 jrieks Exp $
* Overview:
* Parrot Object data members and flags enum
* Data Structure and Algorithms:
@@ -187,14 +187,19 @@
typedef struct PMC_EXT PMC_EXT;
+#ifdef NDEBUG
+# define PMC_ext_checked(pmc) (pmc)->pmc_ext
+#else
+# define PMC_ext_checked(pmc) (assert((pmc)->pmc_ext),
(pmc)->pmc_ext)
+#endif /* NDEBUG */
#if PMC_DATA_IN_EXT
-# define PMC_data(pmc) (pmc)->pmc_ext->data
+# define PMC_data(pmc) PMC_ext_checked(pmc)->data
#else
# define PMC_data(pmc) (pmc)->data
#endif /* PMC_DATA_IN_EXT */
-#define PMC_metadata(pmc) (pmc)->pmc_ext->_metadata
-#define PMC_next_for_GC(pmc) (pmc)->pmc_ext->_next_for_GC
-#define PMC_sync(pmc) (pmc)->pmc_ext->_synchronize
+#define PMC_metadata(pmc) PMC_ext_checked(pmc)->_metadata
+#define PMC_next_for_GC(pmc) PMC_ext_checked(pmc)->_next_for_GC
+#define PMC_sync(pmc) PMC_ext_checked(pmc)->_synchronize
#define PMC_union(pmc) (pmc)->obj.u
/* macro for accessing union data */