summaryrefslogtreecommitdiffstats
path: root/obj-types.h
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-11 14:12:25 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-11 14:12:25 +0000
commit8dad3997505f71e6e9962892f79d7b7dad0a89ce (patch)
treece49da850c9d4deaf6143ef2232766e8c1ccdd35 /obj-types.h
parente095d1ab45b205b4849151b15592c2824f04373a (diff)
downloadrsyslog-8dad3997505f71e6e9962892f79d7b7dad0a89ce.tar.gz
rsyslog-8dad3997505f71e6e9962892f79d7b7dad0a89ce.tar.xz
rsyslog-8dad3997505f71e6e9962892f79d7b7dad0a89ce.zip
file stream objects are now persistet on immediate queue shutdown (queue
itself is not yet fully persisted)
Diffstat (limited to 'obj-types.h')
-rw-r--r--obj-types.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/obj-types.h b/obj-types.h
index 6da56db0..ca7e1c67 100644
--- a/obj-types.h
+++ b/obj-types.h
@@ -83,12 +83,34 @@ typedef struct objInfo_s {
typedef struct obj { /* the dummy struct that each derived class can be casted to */
objInfo_t *pObjInfo;
+#ifndef NDEBUG /* this means if debug... */
+ unsigned int iObjCooCKiE; /* must always be 0xBADEFEE for a valid object */
+#endif
} obj_t;
/* macros which must be gloablly-visible (because they are used during definition of
* other objects.
*/
-#define BEGINobjInstance objInfo_t *pObjInfo
+#ifndef NDEBUG /* this means if debug... */
+# define BEGINobjInstance \
+ objInfo_t *pObjInfo; \
+ unsigned int iObjCooCKiE; /* prevent name conflict, thus the strange name */
+# define ISOBJ_assert(pObj) \
+ { \
+ assert(pObj != NULL); \
+ assert((unsigned) pObj->iObjCooCKiE == (unsigned) 0xBADEFEE); \
+ }
+# define ISOBJ_TYPE_assert(pObj, objType) \
+ { \
+ assert(pObj != NULL); \
+ assert((unsigned) pObj->iObjCooCKiE == (unsigned) 0xBADEFEE); \
+ assert(objGetObjID(pObj) == OBJ##objType); \
+ }
+#else /* non-debug mode, no checks but much faster */
+# define BEGINobjInstance objInfo_t *pObjInfo;
+# define ISOBJ_TYPE_assert(pObj, objType)
+# define ISOBJ_assert(pObj, objType)
+#endif
#define DEFpropSetMeth(obj, prop, dataType)\
rsRetVal obj##Set##prop(obj##_t *pThis, dataType pVal)\
@@ -135,6 +157,7 @@ finalize_it: \
if((pThis = (obj##_t *)calloc(1, sizeof(obj##_t))) == NULL) { \
ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); \
} \
+ objConstructSetObjInfo(pThis); \
\
obj##Initialize(pThis); \
\