summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2012-10-11 09:57:39 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2012-10-11 09:57:39 +0200
commit398704183200adea592bf17059b3c443160efcf6 (patch)
tree59e836cea78fd7fc76bc709d26d1f5da3d271aa9
parentf85690620b74c076de8f26059e5914f72a8bd912 (diff)
downloadrsyslog-398704183200adea592bf17059b3c443160efcf6.tar.gz
rsyslog-398704183200adea592bf17059b3c443160efcf6.tar.xz
rsyslog-398704183200adea592bf17059b3c443160efcf6.zip
slightly improve performance for $NOW family of system properties
-rw-r--r--runtime/msg.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/runtime/msg.c b/runtime/msg.c
index 2ffd4900..473246e6 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -2794,51 +2794,66 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
case PROP_SYS_NOW:
if((pRes = getNOW(NOW_NOW, ttNow)) == NULL) {
RET_OUT_OF_MEMORY;
- } else
- *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */
+ } else {
+ *pbMustBeFreed = 1;
+ *pPropLen = 10;
+ }
break;
case PROP_SYS_YEAR:
if((pRes = getNOW(NOW_YEAR, ttNow)) == NULL) {
RET_OUT_OF_MEMORY;
- } else
-//TODO set pPropLen!
- *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */
+ } else {
+ *pbMustBeFreed = 1;
+ *pPropLen = 4;
+ }
break;
case PROP_SYS_MONTH:
if((pRes = getNOW(NOW_MONTH, ttNow)) == NULL) {
RET_OUT_OF_MEMORY;
- } else
- *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */
+ } else {
+ *pbMustBeFreed = 1;
+ *pPropLen = 2;
+ }
break;
case PROP_SYS_DAY:
if((pRes = getNOW(NOW_DAY, ttNow)) == NULL) {
RET_OUT_OF_MEMORY;
- } else
- *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */
+ } else {
+ *pbMustBeFreed = 1;
+ *pPropLen = 2;
+ }
break;
case PROP_SYS_HOUR:
if((pRes = getNOW(NOW_HOUR, ttNow)) == NULL) {
RET_OUT_OF_MEMORY;
- } else
- *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */
+ } else {
+ *pbMustBeFreed = 1;
+ *pPropLen = 2;
+ }
break;
case PROP_SYS_HHOUR:
if((pRes = getNOW(NOW_HHOUR, ttNow)) == NULL) {
RET_OUT_OF_MEMORY;
- } else
- *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */
+ } else {
+ *pbMustBeFreed = 1;
+ *pPropLen = 2;
+ }
break;
case PROP_SYS_QHOUR:
if((pRes = getNOW(NOW_QHOUR, ttNow)) == NULL) {
RET_OUT_OF_MEMORY;
- } else
- *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */
+ } else {
+ *pbMustBeFreed = 1;
+ *pPropLen = 2;
+ }
break;
case PROP_SYS_MINUTE:
if((pRes = getNOW(NOW_MINUTE, ttNow)) == NULL) {
RET_OUT_OF_MEMORY;
- } else
- *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */
+ } else {
+ *pbMustBeFreed = 1;
+ *pPropLen = 2;
+ }
break;
case PROP_SYS_MYHOSTNAME:
pRes = glbl.GetLocalHostName();