diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-10-11 09:12:20 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-10-11 09:12:20 +0200 |
commit | f85690620b74c076de8f26059e5914f72a8bd912 (patch) | |
tree | 2b03f3b2d8ce22b90e2239d87459074819dcfd2b /template.c | |
parent | dc724fcd2e1a8fcd8c2b3c309fa1c1a3f7bc73ea (diff) | |
download | rsyslog-f85690620b74c076de8f26059e5914f72a8bd912.tar.gz rsyslog-f85690620b74c076de8f26059e5914f72a8bd912.tar.xz rsyslog-f85690620b74c076de8f26059e5914f72a8bd912.zip |
do "template date call" only when actually needed
Diffstat (limited to 'template.c')
-rw-r--r-- | template.c | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -380,6 +380,38 @@ finalize_it: } +/* Check if the template requires a date call (actually a cached + * date structure). This currently is the case for the $NOW family + * of properties. + */ +int +tplRequiresDateCall(struct template *pTpl) +{ + struct templateEntry *pTpe; + int r = 0; + + if(pTpl->subtree != NULL) + goto done; + + for(pTpe = pTpl->pEntryRoot ; pTpe != NULL ; pTpe = pTpe->pNext) { + switch(pTpe->data.field.propid) { + case PROP_SYS_NOW: + case PROP_SYS_YEAR: + case PROP_SYS_MONTH: + case PROP_SYS_DAY: + case PROP_SYS_HOUR: + case PROP_SYS_HHOUR: + case PROP_SYS_QHOUR: + case PROP_SYS_MINUTE: + r = 1; + goto done; + default:break; + } + } +done: return r; +} + + /* Helper to doEscape. This is called if doEscape * runs out of memory allocating the escaped string. * Then we are in trouble. We can |