summaryrefslogtreecommitdiffstats
path: root/obj.h
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-10 08:00:47 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-10 08:00:47 +0000
commit24c125cfc3032e6269e6e5de91c72c91508adde0 (patch)
treea3f86f5dc3ff9e23c46f845bdb64e0a50ae84a24 /obj.h
parent2dccfb6780c89cf9ac5e215afd7d2a18ee211840 (diff)
downloadrsyslog-24c125cfc3032e6269e6e5de91c72c91508adde0.tar.gz
rsyslog-24c125cfc3032e6269e6e5de91c72c91508adde0.tar.xz
rsyslog-24c125cfc3032e6269e6e5de91c72c91508adde0.zip
made queue file names better readable
Diffstat (limited to 'obj.h')
-rw-r--r--obj.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/obj.h b/obj.h
index 7a5b07f1..ab9470ac 100644
--- a/obj.h
+++ b/obj.h
@@ -47,6 +47,34 @@
#include "obj-types.h"
#include "stream.h"
+/* macros */
+/* the following one is a helper that prevents us from writing the
+ * ever-same code at the end of Construct()
+ */
+#define OBJCONSTRUCT_CHECK_SUCCESS_AND_CLEANUP \
+ if(iRet == RS_RET_OK) { \
+ *ppThis = pThis; \
+ } else { \
+ if(pThis != NULL) \
+ free(pThis); \
+ }
+
+#define objSerializeSCALAR(propName, propType) \
+ CHKiRet(objSerializeProp(pCStr, (uchar*) #propName, PROPTYPE_##propType, (void*) &pThis->propName));
+#define objSerializePTR(propName, propType) \
+ CHKiRet(objSerializeProp(pCStr, (uchar*) #propName, PROPTYPE_##propType, (void*) pThis->propName));
+#define DEFobjStaticHelpers static objInfo_t *pObjInfoOBJ = NULL;
+#define objGetName(pThis) (((obj_t*) (pThis))->pObjInfo->pszName)
+#define objGetObjID(pThis) (((obj_t*) (pThis))->pObjInfo->objID)
+#define objGetVersion(pThis) (((obj_t*) (pThis))->pObjInfo->iObjVers)
+/* must be called in Constructor: */
+#define objConstructSetObjInfo(pThis) ((obj_t*) (pThis))->pObjInfo = pObjInfoOBJ;
+#define objDestruct(pThis) (((obj_t*) (pThis))->pObjInfo->objMethods[objMethod_DESTRUCT])(pThis)
+#define objSerialize(pThis) (((obj_t*) (pThis))->pObjInfo->objMethods[objMethod_SERIALIZE])
+
+#define OBJSetMethodHandler(methodID, pHdlr) \
+ CHKiRet(objInfoSetMethod(pObjInfoOBJ, methodID, (rsRetVal (*)(void*)) pHdlr))
+
/* prototypes */
rsRetVal objInfoConstruct(objInfo_t **ppThis, objID_t objID, uchar *pszName, int iObjVers, rsRetVal (*pConstruct)(void *), rsRetVal (*pDestruct)(void *));
rsRetVal objInfoSetMethod(objInfo_t *pThis, objMethod_t objMethod, rsRetVal (*pHandler)(void*));