summaryrefslogtreecommitdiffstats
path: root/module-template.h
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-25 10:36:13 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-25 10:36:13 +0000
commita3192ac18ed9df7d95d0c8d5795994e867c85eca (patch)
tree4444071f9615b71645ea652ef0feaa12db7657e6 /module-template.h
parent4c69b80ca0366db28bbbb46ddd03dfbc9d85b09c (diff)
downloadrsyslog-a3192ac18ed9df7d95d0c8d5795994e867c85eca.tar.gz
rsyslog-a3192ac18ed9df7d95d0c8d5795994e867c85eca.tar.xz
rsyslog-a3192ac18ed9df7d95d0c8d5795994e867c85eca.zip
changed calling interface for freeInstance() - need to work with dual
buffers in order to change output modules one by one
Diffstat (limited to 'module-template.h')
-rw-r--r--module-template.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/module-template.h b/module-template.h
index 6ce1a08f..843440b5 100644
--- a/module-template.h
+++ b/module-template.h
@@ -45,8 +45,10 @@ static rsRetVal createInstance(instanceData **ppData)\
instanceData *pData; /* use this to point to data elements */
#define CODESTARTcreateInstance \
- if((pData = calloc(1, sizeof(instanceData))) == NULL)\
- return RS_RET_OUT_OF_MEMORY;
+ if((pData = calloc(1, sizeof(instanceData))) == NULL) {\
+ *ppData = NULL;\
+ return RS_RET_OUT_OF_MEMORY;\
+ }
#define ENDcreateInstance \
*ppData = pData;\
@@ -56,14 +58,18 @@ static rsRetVal createInstance(instanceData **ppData)\
/* freeInstance()
*/
#define BEGINfreeInstance \
-static rsRetVal freeInstance(selector_t *f)\
+static rsRetVal freeInstance(selector_t *f, void* pModData)\
{\
- rsRetVal iRet = RS_RET_OK;
+ rsRetVal iRet = RS_RET_OK;\
+ instanceData *pData;
#define CODESTARTfreeInstance \
- assert(f != NULL);
+ assert(f != NULL);\
+ pData = (instanceData*) pModData;
#define ENDfreeInstance \
+ if(pData != NULL)\
+ free(pData); /* we need to free this in any case */\
return iRet;\
}