summaryrefslogtreecommitdiffstats
path: root/runtime/msg.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 /runtime/msg.c
parentf18c0ffb9a6de737d2b86b3df164ead22ac5ef58 (diff)
downloadrsyslog-df9012f755a305ef48037f10fcc9413406894e66.tar.gz
rsyslog-df9012f755a305ef48037f10fcc9413406894e66.tar.xz
rsyslog-df9012f755a305ef48037f10fcc9413406894e66.zip
slight optimization of template generation
Diffstat (limited to 'runtime/msg.c')
-rw-r--r--runtime/msg.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/runtime/msg.c b/runtime/msg.c
index 39f2370c..67aaf250 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -1848,7 +1848,8 @@ static uchar *getNOW(eNOWType eNow)
* rgerhards 2005-09-15
*/
char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
- cstr_t *pCSPropName, unsigned short *pbMustBeFreed)
+ cstr_t *pCSPropName, size_t *pPropLen,
+ unsigned short *pbMustBeFreed)
{
uchar *pName;
char *pRes; /* result pointer */
@@ -2546,6 +2547,10 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
*pbMustBeFreed = 1;
}
+ if(bufLen == -1)
+ bufLen = strlen(pRes);
+ *pPropLen = bufLen;
+
/*dbgprintf("MsgGetProp(\"%s\"): \"%s\"\n", pName, pRes); only for verbose debug logging */
return(pRes);
}
@@ -2561,6 +2566,7 @@ msgGetMsgVar(msg_t *pThis, cstr_t *pstrPropName, var_t **ppVar)
{
DEFiRet;
var_t *pVar;
+ size_t propLen;
uchar *pszProp = NULL;
cstr_t *pstrProp;
unsigned short bMustBeFreed = 0;
@@ -2574,7 +2580,7 @@ msgGetMsgVar(msg_t *pThis, cstr_t *pstrPropName, var_t **ppVar)
CHKiRet(var.ConstructFinalize(pVar));
/* always call MsgGetProp() without a template specifier */
- pszProp = (uchar*) MsgGetProp(pThis, NULL, pstrPropName, &bMustBeFreed);
+ pszProp = (uchar*) MsgGetProp(pThis, NULL, pstrPropName, &propLen, &bMustBeFreed);
/* now create a string object out of it and hand that over to the var */
CHKiRet(rsCStrConstructFromszStr(&pstrProp, pszProp));