summaryrefslogtreecommitdiffstats
path: root/action.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-01-13 14:40:17 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2013-01-13 14:40:17 +0100
commit8339d54ddcbc93771fb6eb550cbf2d9ade988fb8 (patch)
treefbd8392c5d988350de75f2c0dc1ed8707ca203e2 /action.c
parent3d5c805ab6d4e9b8db0a948cda0f73340f2f326b (diff)
downloadrsyslog-8339d54ddcbc93771fb6eb550cbf2d9ade988fb8.tar.gz
rsyslog-8339d54ddcbc93771fb6eb550cbf2d9ade988fb8.tar.bz2
rsyslog-8339d54ddcbc93771fb6eb550cbf2d9ade988fb8.zip
optimize: do date() call in template processing only if actually needed
Diffstat (limited to 'action.c')
-rw-r--r--action.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/action.c b/action.c
index ccc07061..88c8f225 100644
--- a/action.c
+++ b/action.c
@@ -1213,9 +1213,8 @@ prepareBatch(action_t *pAction, batch_t *pBatch, sbool **activeSave, int *bMustR
struct syslogTime ttNow;
DEFiRet;
- if(pAction->requiresDateCall) {
- datetime.getCurrTime(&ttNow, NULL);
- }
+ /* indicate we have not yet read the date */
+ ttNow.year = 0;
pBatch->iDoneUpTo = 0;
for(i = 0 ; i < batchNumMsgs(pBatch) && !*(pBatch->pbShutdownImmediate) ; ++i) {
@@ -1771,27 +1770,6 @@ actionApplyCnfParam(action_t *pAction, struct cnfparamvals *pvals)
return RS_RET_OK;
}
-/* check if the templates used in this action require a date call
- * ($NOW family of properties).
- */
-static inline int
-actionRequiresDateCall(action_t *pAction)
-{
- int i;
- int r = 0;
-
- if(pAction->eParamPassing == ACT_MSG_PASSING)
- /* in msg passing mode, we have NO templates! */
- goto done;
- for(i = 0 ; i < pAction->iNumTpls ; ++i) {
- if(tplRequiresDateCall(pAction->ppTpl[i])) {
- r = 1;
- break;
- }
- }
-done: return r;
-}
-
/* add an Action to the current selector
* The pOMSR is freed, as it is not needed after this function.
@@ -1890,7 +1868,6 @@ addAction(action_t **ppAction, modInfo_t *pMod, void *pModData,
pAction->pModData = pModData;
/* check if the module is compatible with select features (currently no such features exist) */
pAction->eState = ACT_STATE_RDY; /* action is enabled */
- pAction->requiresDateCall = actionRequiresDateCall(pAction);
if(bSuspended)
actionSuspend(pAction, datetime.GetTime(NULL)); /* "good" time call, only during init and unavoidable */