diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-10 08:00:47 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-10 08:00:47 +0000 |
commit | 24c125cfc3032e6269e6e5de91c72c91508adde0 (patch) | |
tree | a3f86f5dc3ff9e23c46f845bdb64e0a50ae84a24 /obj-types.h | |
parent | 2dccfb6780c89cf9ac5e215afd7d2a18ee211840 (diff) | |
download | rsyslog-24c125cfc3032e6269e6e5de91c72c91508adde0.tar.gz rsyslog-24c125cfc3032e6269e6e5de91c72c91508adde0.tar.bz2 rsyslog-24c125cfc3032e6269e6e5de91c72c91508adde0.zip |
made queue file names better readable
Diffstat (limited to 'obj-types.h')
-rw-r--r-- | obj-types.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/obj-types.h b/obj-types.h index 005d6a4d..6da56db0 100644 --- a/obj-types.h +++ b/obj-types.h @@ -113,5 +113,35 @@ finalize_it: \ return iRet; \ } +/* this defines both the constructor and initializer + * rgerhards, 2008-01-10 + */ +#define BEGINobjConstruct(obj) \ + rsRetVal obj##Initialize(obj##_t *pThis) \ + { \ + DEFiRet; + +#define ENDobjConstruct(obj) \ + /* use finalize_it: before calling the macro (if you need it)! */ \ + return iRet; \ + } \ + rsRetVal obj##Construct(obj##_t **ppThis) \ + { \ + DEFiRet; \ + obj##_t *pThis; \ + \ + assert(ppThis != NULL); \ + \ + if((pThis = (obj##_t *)calloc(1, sizeof(obj##_t))) == NULL) { \ + ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); \ + } \ + \ + obj##Initialize(pThis); \ + \ + finalize_it: \ + OBJCONSTRUCT_CHECK_SUCCESS_AND_CLEANUP \ + return iRet; \ + } + #endif /* #ifndef OBJ_TYPES_H_INCLUDED */ |