summaryrefslogtreecommitdiffstats
path: root/template.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-06-18 16:20:06 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-06-18 16:20:06 +0200
commitdf9012f755a305ef48037f10fcc9413406894e66 (patch)
tree1aed124ca0396ace409a5550bf39c8432ec5f15c /template.c
parentf18c0ffb9a6de737d2b86b3df164ead22ac5ef58 (diff)
downloadrsyslog-df9012f755a305ef48037f10fcc9413406894e66.tar.gz
rsyslog-df9012f755a305ef48037f10fcc9413406894e66.tar.xz
rsyslog-df9012f755a305ef48037f10fcc9413406894e66.zip
slight optimization of template generation
Diffstat (limited to 'template.c')
-rw-r--r--template.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/template.c b/template.c
index 6e34bcd8..aacd4dbd 100644
--- a/template.c
+++ b/template.c
@@ -103,8 +103,7 @@ rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar** ppSz)
FINALIZE;
}
} else if(pTpe->eEntryType == FIELD) {
- pVal = (uchar*) MsgGetProp(pMsg, pTpe, NULL, &bMustBeFreed);
- iLenVal = strlen((char*) pVal);
+ pVal = (uchar*) MsgGetProp(pMsg, pTpe, NULL, &iLenVal, &bMustBeFreed);
/* we now need to check if we should use SQL option. In this case,
* we must go over the generated string and escape '\'' characters.
* rgerhards, 2005-09-22: the option values below look somewhat misplaced,
@@ -158,6 +157,7 @@ rsRetVal tplToArray(struct template *pTpl, msg_t *pMsg, uchar*** ppArr)
struct templateEntry *pTpe;
uchar **pArr;
int iArr;
+ size_t propLen;
unsigned short bMustBeFreed;
uchar *pVal;
@@ -178,7 +178,7 @@ rsRetVal tplToArray(struct template *pTpl, msg_t *pMsg, uchar*** ppArr)
if(pTpe->eEntryType == CONSTANT) {
CHKmalloc(pArr[iArr] = (uchar*)strdup((char*) pTpe->data.constant.pConstant));
} else if(pTpe->eEntryType == FIELD) {
- pVal = (uchar*) MsgGetProp(pMsg, pTpe, NULL, &bMustBeFreed);
+ pVal = (uchar*) MsgGetProp(pMsg, pTpe, NULL, &propLen, &bMustBeFreed);
if(bMustBeFreed) { /* if it must be freed, it is our own private copy... */
pArr[iArr] = pVal; /* ... so we can use it! */
} else {