summaryrefslogtreecommitdiffstats
path: root/plugins/imklog/imklog.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-07-01 14:33:19 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-07-01 14:33:19 +0200
commit7bfa03bdc0b73647ffdbe4b73e5c1649af665fbf (patch)
tree545a24dd681bd28455702b06dff41f7814bf3561 /plugins/imklog/imklog.c
parentd6faee67b413d1f257c96a14e46f15ec1868a365 (diff)
downloadrsyslog-7bfa03bdc0b73647ffdbe4b73e5c1649af665fbf.tar.gz
rsyslog-7bfa03bdc0b73647ffdbe4b73e5c1649af665fbf.tar.xz
rsyslog-7bfa03bdc0b73647ffdbe4b73e5c1649af665fbf.zip
now put the new property-based methods to good use
... hopefully reducing the number of allocs/frees as well as overall memory usage in a busy system (plus that these shared properties hopefully remain in cache longer than its single-instance counterparts...)
Diffstat (limited to 'plugins/imklog/imklog.c')
-rw-r--r--plugins/imklog/imklog.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c
index 269cfee0..2a832bee 100644
--- a/plugins/imklog/imklog.c
+++ b/plugins/imklog/imklog.c
@@ -84,6 +84,7 @@ int console_log_level = -1;
static prop_t *pInputName = NULL; /* there is only one global inputName for all messages generated by this module */
+static prop_t *pLocalHostIP = NULL; /* a pseudo-constant propterty for 127.0.0.1 */
/* enqueue the the kernel message into the message queue.
* The provided msg string is not freed - thus must be done
@@ -105,7 +106,7 @@ enqMsg(uchar *msg, uchar* pszTag, int iFacility, int iSeverity)
MsgSetRawMsgWOSize(pMsg, (char*)msg);
MsgSetMSGoffs(pMsg, 0); /* we do not have a header... */
MsgSetRcvFrom(pMsg, glbl.GetLocalHostNameProp());
- MsgSetRcvFromIPStr(pMsg, (uchar*)"127.0.0.1", sizeof("127.0.0.1") - 1);
+ MsgSetRcvFromIP(pMsg, pLocalHostIP);
MsgSetHOSTNAME(pMsg, glbl.GetLocalHostName(), ustrlen(glbl.GetLocalHostName()));
MsgSetTAG(pMsg, pszTag, ustrlen(pszTag));
pMsg->iFacility = LOG_FAC(iFacility);
@@ -235,9 +236,8 @@ ENDrunInput
BEGINwillRun
CODESTARTwillRun
/* we need to create the inputName property (only once during our lifetime) */
- CHKiRet(prop.Construct(&pInputName));
- CHKiRet(prop.SetString(pInputName, UCHAR_CONSTANT("imklog"), sizeof("imklog") - 1));
- CHKiRet(prop.ConstructFinalize(pInputName));
+ CHKiRet(prop.CreateStringProp(&pInputName, UCHAR_CONSTANT("imklog"), sizeof("imklog") - 1));
+ CHKiRet(prop.CreateStringProp(&pLocalHostIP, UCHAR_CONSTANT("127.0.0.1"), sizeof("127.0.0.1") - 1));
iRet = klogWillRun();
finalize_it:
@@ -250,6 +250,8 @@ CODESTARTafterRun
if(pInputName != NULL)
prop.Destruct(&pInputName);
+ if(pLocalHostIP != NULL)
+ prop.Destruct(&pLocalHostIP);
ENDafterRun