summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-06-18 13:22:21 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-06-18 13:22:21 +0200
commit8628312396b1535c41124e499d292f4d1e77d955 (patch)
treed294b3fc3f9adc29b3b9137ce2bff55c21fdee81 /plugins
parentf529e8b2c3bb2c087bfba3fc5610a66fdbe1a8ae (diff)
downloadrsyslog-8628312396b1535c41124e499d292f4d1e77d955.tar.gz
rsyslog-8628312396b1535c41124e499d292f4d1e77d955.tar.xz
rsyslog-8628312396b1535c41124e499d292f4d1e77d955.zip
cleaned up/optimized raw message handling in msg object
Diffstat (limited to 'plugins')
-rw-r--r--plugins/imdiag/imdiag.c3
-rw-r--r--plugins/imfile/imfile.c2
-rw-r--r--plugins/imklog/imklog.c2
-rw-r--r--plugins/imudp/imudp.c5
4 files changed, 4 insertions, 8 deletions
diff --git a/plugins/imdiag/imdiag.c b/plugins/imdiag/imdiag.c
index 51f319ca..bfb4a2e5 100644
--- a/plugins/imdiag/imdiag.c
+++ b/plugins/imdiag/imdiag.c
@@ -205,8 +205,7 @@ doInjectMsg(int iNum)
datetime.getCurrTime(&stTime, &ttGenTime);
/* we now create our own message object and submit it to the queue */
CHKiRet(msgConstructWithTime(&pMsg, &stTime, ttGenTime));
- CHKmalloc(pMsg->pszRawMsg = ustrdup(szMsg));
- pMsg->iLenRawMsg = ustrlen(szMsg);
+ MsgSetRawMsg(pMsg, (char*) szMsg, ustrlen(szMsg));
MsgSetInputName(pMsg, UCHAR_CONSTANT("imdiag"), sizeof("imdiag")-1);
MsgSetFlowControlType(pMsg, eFLOWCTL_NO_DELAY);
pMsg->msgFlags = NEEDS_PARSING | PARSE_HOSTNAME;
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c
index 86270e2d..bdd222c4 100644
--- a/plugins/imfile/imfile.c
+++ b/plugins/imfile/imfile.c
@@ -97,7 +97,7 @@ static rsRetVal enqLine(fileInfo_t *pInfo, cstr_t *cstrLine)
CHKiRet(msgConstruct(&pMsg));
MsgSetFlowControlType(pMsg, eFLOWCTL_FULL_DELAY);
MsgSetInputName(pMsg, UCHAR_CONSTANT("imfile"), sizeof("imfile")-1);
- MsgSetRawMsg(pMsg, (char*)rsCStrGetSzStr(cstrLine));
+ MsgSetRawMsg(pMsg, (char*)rsCStrGetSzStr(cstrLine), cstrLen(cstrLine));
MsgSetMSG(pMsg, (char*)rsCStrGetSzStr(cstrLine));
MsgSetHOSTNAME(pMsg, glbl.GetLocalHostName());
MsgSetTAG(pMsg, (char*)pInfo->pszTag);
diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c
index 420ebbf1..24f15510 100644
--- a/plugins/imklog/imklog.c
+++ b/plugins/imklog/imklog.c
@@ -96,7 +96,7 @@ enqMsg(uchar *msg, uchar* pszTag, int iFacility, int iSeverity)
CHKiRet(msgConstruct(&pMsg));
MsgSetFlowControlType(pMsg, eFLOWCTL_LIGHT_DELAY);
MsgSetInputName(pMsg, UCHAR_CONSTANT("imklog"), sizeof("imklog")-1);
- MsgSetRawMsg(pMsg, (char*)msg);
+ MsgSetRawMsgWOSize(pMsg, (char*)msg);
MsgSetMSG(pMsg, (char*)msg);
MsgSetRcvFrom(pMsg, glbl.GetLocalHostName());
MsgSetRcvFromIP(pMsg, (uchar*)"127.0.0.1");
diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c
index 97e66e8e..2340aac4 100644
--- a/plugins/imudp/imudp.c
+++ b/plugins/imudp/imudp.c
@@ -241,10 +241,7 @@ processSocket(int fd, struct sockaddr_storage *frominetPrev, int *pbIsPermitted,
}
/* we now create our own message object and submit it to the queue */
CHKiRet(msgConstructWithTime(&pMsg, &stTime, ttGenTime));
- /* first trim the buffer to what we have actually received */
- CHKmalloc(pMsg->pszRawMsg = malloc(sizeof(uchar)* lenRcvBuf));
- memcpy(pMsg->pszRawMsg, pRcvBuf, lenRcvBuf);
- pMsg->iLenRawMsg = lenRcvBuf;
+ MsgSetRawMsg(pMsg, (char*)pRcvBuf, lenRcvBuf);
MsgSetInputName(pMsg, UCHAR_CONSTANT("imudp"), sizeof("imudp")-1);
MsgSetFlowControlType(pMsg, eFLOWCTL_NO_DELAY);
pMsg->msgFlags = NEEDS_PARSING | PARSE_HOSTNAME;