diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-06-10 12:24:22 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-06-10 12:24:22 +0200 |
commit | 74135da95971c8d03e4e45f7d3f703e1d40f76f4 (patch) | |
tree | 604dc7b4aaf7af91040ea96cc63399cd5b2269df /action.c | |
parent | 13b5c6b145cfb2c9f4d5f9291115bf0fe7a7156c (diff) | |
download | rsyslog-74135da95971c8d03e4e45f7d3f703e1d40f76f4.tar.gz rsyslog-74135da95971c8d03e4e45f7d3f703e1d40f76f4.tar.xz rsyslog-74135da95971c8d03e4e45f7d3f703e1d40f76f4.zip |
some cleanup
as well as some work in preparation of storing doAction params inside
the batch
Diffstat (limited to 'action.c')
-rw-r--r-- | action.c | 74 |
1 files changed, 17 insertions, 57 deletions
@@ -191,7 +191,6 @@ actionResetQueueParams(void) */ rsRetVal actionDestruct(action_t *pThis) { - int i; DEFiRet; ASSERT(pThis != NULL); @@ -210,37 +209,6 @@ rsRetVal actionDestruct(action_t *pThis) d_free(pThis->pszName); d_free(pThis->ppTpl); - /* message ptr cleanup */ -#if 0 - for(i = 0 ; i < pThis->iNumTpls ; ++i) { - if(((uchar**)pThis->ppMsgs)[i] != NULL) { - switch(pThis->eParamPassing) { - case ACT_ARRAY_PASSING: -#if 0 /* later, as an optimization. So far, we do the cleanup after each message */ - iArr = 0; - while(((char **)pThis->ppMsgs[i])[iArr] != NULL) { - d_free(((char **)pThis->ppMsgs[i])[iArr++]); - ((char **)pThis->ppMsgs[i])[iArr++] = NULL; - } - d_free(pThis->ppMsgs[i]); - pThis->ppMsgs[i] = NULL; -#endif - break; - case ACT_STRING_PASSING: - d_free(((uchar**)pThis->ppMsgs)[i]); - break; - case ACT_MSG_PASSING: - /* No cleanup needed in this case */ - break; - default: - assert(0); - } - } - } - d_free(pThis->ppMsgs); -#endif - d_free(pThis->lenMsgs); - d_free(pThis); RETiRet; @@ -721,36 +689,26 @@ finalize_it: /* cleanup doAction calling parameters * rgerhards, 2009-05-07 */ -static rsRetVal cleanupDoActionParams(action_t *pAction) +//TODO: check if this is still needed! +static rsRetVal cleanupDoActionParams(action_t *pAction, uchar **ppMsgs) { - int i; int iArr; + int i; DEFiRet; ASSERT(pAction != NULL); -#if 0 for(i = 0 ; i < pAction->iNumTpls ; ++i) { - if(((uchar**)pAction->ppMsgs)[i] != NULL) { - switch(pAction->eParamPassing) { - case ACT_ARRAY_PASSING: - iArr = 0; - while((((uchar***)pAction->ppMsgs)[i][iArr]) != NULL) { - d_free(((uchar ***)pAction->ppMsgs)[i][iArr++]); - ((uchar ***)pAction->ppMsgs)[i][iArr++] = NULL; - } - d_free(((uchar**)pAction->ppMsgs)[i]); - ((uchar**)pAction->ppMsgs)[i] = NULL; - break; - case ACT_MSG_PASSING: - case ACT_STRING_PASSING: - break; - default: - assert(0); + if(((uchar**)ppMsgs)[i] != NULL) { + iArr = 0; + while((((uchar***)ppMsgs)[i][iArr]) != NULL) { + d_free(((uchar ***)ppMsgs)[i][iArr++]); + ((uchar ***)ppMsgs)[i][iArr++] = NULL; } + d_free(((uchar**)ppMsgs)[i]); + ((uchar**)ppMsgs)[i] = NULL; } } -#endif RETiRet; } @@ -824,13 +782,18 @@ iRet = RS_RET_OK; iRet = getReturnCode(pThis); finalize_it: - cleanupDoActionParams(pThis); /* iRet ignored! */ - + switch(pThis->eParamPassing) { case ACT_STRING_PASSING: for(i = 0 ; i < 10 ; ++i) free(ppMsgs[i]); break; + case ACT_ARRAY_PASSING: + cleanupDoActionParams(pThis, ppMsgs); /* iRet ignored! */ + break; + case ACT_MSG_PASSING: + /* nothing to do in that case */ + break; } @@ -1384,7 +1347,6 @@ doSubmitToActionQ(action_t *pAction, msg_t *pMsg) } - /* Call configured action, most complex case with all features supported (and thus slow). * rgerhards, 2010-06-08 */ @@ -1453,8 +1415,6 @@ addAction(action_t **ppAction, modInfo_t *pMod, void *pModData, omodStringReques if(pAction->iNumTpls > 0) { /* we first need to create the template pointer array */ CHKmalloc(pAction->ppTpl = (struct template **)calloc(pAction->iNumTpls, sizeof(struct template *))); -//TODO: remove //CHKmalloc(pAction->ppMsgs = (uchar**) calloc(pAction->iNumTpls, sizeof(uchar *))); - CHKmalloc(pAction->lenMsgs = (size_t*) calloc(pAction->iNumTpls, sizeof(size_t))); } for(i = 0 ; i < pAction->iNumTpls ; ++i) { |