summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-02-21 07:00:29 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-02-21 07:00:29 +0000
commit013073f1a6f1ed2230feaba0865d0c14212577d0 (patch)
tree5dd528a004f730658f16a012c66726417ff750d3
parent44bb5af7ccef417a1d088527fc02af5f0e8d3dc5 (diff)
downloadrsyslog-013073f1a6f1ed2230feaba0865d0c14212577d0.tar.gz
rsyslog-013073f1a6f1ed2230feaba0865d0c14212577d0.tar.xz
rsyslog-013073f1a6f1ed2230feaba0865d0c14212577d0.zip
changed rsCStrObj name to cstr_t, which is more inline with the rest of
rsyslog (now) and also much easier to type
-rw-r--r--cfsysline.c6
-rw-r--r--conf.c8
-rw-r--r--conf.h4
-rw-r--r--ctok_token.c4
-rw-r--r--ctok_token.h4
-rw-r--r--expr.c4
-rw-r--r--msg.c2
-rw-r--r--msg.h12
-rw-r--r--obj.c8
-rw-r--r--outchannel.c4
-rw-r--r--parse.c14
-rw-r--r--parse.h8
-rw-r--r--plugins/imfile/imfile.c4
-rw-r--r--stream.c4
-rw-r--r--stream.h2
-rwxr-xr-xstringbuf.c62
-rwxr-xr-xstringbuf.h319
-rw-r--r--syslogd.c2
-rw-r--r--syslogd.h8
-rw-r--r--template.c8
-rw-r--r--var.c2
-rw-r--r--var.h6
22 files changed, 247 insertions, 248 deletions
diff --git a/cfsysline.c b/cfsysline.c
index 27a3efd3..35ff76ad 100644
--- a/cfsysline.c
+++ b/cfsysline.c
@@ -444,7 +444,7 @@ finalize_it:
* rgerhards, 2008-02-14
*/
static rsRetVal
-getWord(uchar **pp, rsCStrObj **ppStrB)
+getWord(uchar **pp, cstr_t **ppStrB)
{
DEFiRet;
uchar *p;
@@ -486,7 +486,7 @@ finalize_it:
static rsRetVal doGetWord(uchar **pp, rsRetVal (*pSetHdlr)(void*, uchar*), void *pVal)
{
DEFiRet;
- rsCStrObj *pStrB;
+ cstr_t *pStrB;
uchar *pNewVal;
ASSERT(pp != NULL);
@@ -528,7 +528,7 @@ static rsRetVal
doSyslogName(uchar **pp, rsRetVal (*pSetHdlr)(void*, int), void *pVal, syslogName_t *pNameTable)
{
DEFiRet;
- rsCStrObj *pStrB;
+ cstr_t *pStrB;
int iNewVal;
ASSERT(pp != NULL);
diff --git a/conf.c b/conf.c
index f1a996c7..4fcf962e 100644
--- a/conf.c
+++ b/conf.c
@@ -66,8 +66,8 @@ uchar *pModDir = NULL; /* read-only after startup */
* of course, during a reload). rgerhards 2005-10-18
*/
EHostnameCmpMode eDfltHostnameCmpMode;
-rsCStrObj *pDfltHostnameCmp;
-rsCStrObj *pDfltProgNameCmp;
+cstr_t *pDfltHostnameCmp;
+cstr_t *pDfltProgNameCmp;
/* process a directory and include all of its files into
@@ -476,7 +476,7 @@ rsRetVal cflineParseTemplateName(uchar** pp, omodStringRequest_t *pOMSR, int iEn
uchar *p;
uchar *tplName;
DEFiRet;
- rsCStrObj *pStrB;
+ cstr_t *pStrB;
ASSERT(pp != NULL);
ASSERT(*pp != NULL);
@@ -791,7 +791,7 @@ finalize_it:
static rsRetVal cflineProcessPropFilter(uchar **pline, register selector_t *f)
{
rsParsObj *pPars;
- rsCStrObj *pCSCompOp;
+ cstr_t *pCSCompOp;
rsRetVal iRet;
int iOffset; /* for compare operations */
diff --git a/conf.h b/conf.h
index 0b24af36..83ad78bf 100644
--- a/conf.h
+++ b/conf.h
@@ -40,7 +40,7 @@ rsRetVal processConfFile(uchar *pConfFile);
/* TODO: remove them below (means move the config init code) -- rgerhards, 2008-02-19 */
extern uchar *pModDir; /* read-only after startup */
extern EHostnameCmpMode eDfltHostnameCmpMode;
-extern rsCStrObj *pDfltHostnameCmp;
-extern rsCStrObj *pDfltProgNameCmp;
+extern cstr_t *pDfltHostnameCmp;
+extern cstr_t *pDfltProgNameCmp;
#endif /* #ifndef INCLUDED_CONF_H */
diff --git a/ctok_token.c b/ctok_token.c
index a0f6b18d..11667323 100644
--- a/ctok_token.c
+++ b/ctok_token.c
@@ -61,13 +61,13 @@ CODESTARTobjDestruct(ctok_token)
ENDobjDestruct(ctok_token)
-/* get the rsCStrObj from the token, but do not destruct it. This is meant to
+/* get the cstr_t from the token, but do not destruct it. This is meant to
* be used by a caller who passes on the string to some other function. The
* caller is responsible for destructing it.
* rgerhards, 2008-02-20
*/
rsRetVal
-ctok_tokenUnlinkCStr(ctok_token_t *pThis, rsCStrObj **ppCStr)
+ctok_tokenUnlinkCStr(ctok_token_t *pThis, cstr_t **ppCStr)
{
DEFiRet;
diff --git a/ctok_token.h b/ctok_token.h
index b7d3cf19..a93cfe49 100644
--- a/ctok_token.h
+++ b/ctok_token.h
@@ -61,7 +61,7 @@ typedef struct {
ctok_CMP_STARTSWITH = 106,
ctok_CMP_GTEQ = 107, /* end compare operations */
} tok;
- rsCStrObj *pstrVal;
+ cstr_t *pstrVal;
int64 intVal;
} ctok_token_t;
@@ -73,7 +73,7 @@ typedef struct {
rsRetVal ctok_tokenConstruct(ctok_token_t **ppThis);
rsRetVal ctok_tokenConstructFinalize(ctok_token_t __attribute__((unused)) *pThis);
rsRetVal ctok_tokenDestruct(ctok_token_t **ppThis);
-rsRetVal ctok_tokenUnlinkCStr(ctok_token_t *pThis, rsCStrObj **ppCStr);
+rsRetVal ctok_tokenUnlinkCStr(ctok_token_t *pThis, cstr_t **ppCStr);
PROTOTYPEObjClassInit(ctok_token);
#endif /* #ifndef INCLUDED_CTOK_TOKEN_H */
diff --git a/expr.c b/expr.c
index 46f755fa..f43e6ce7 100644
--- a/expr.c
+++ b/expr.c
@@ -60,7 +60,7 @@ terminal(expr_t *pThis, ctok_t *ctok)
DEFiRet;
ctok_token_t *pToken;
var_t *pVar;
- rsCStrObj *pCStr;
+ cstr_t *pCStr;
ISOBJ_TYPE_assert(pThis, expr);
ISOBJ_TYPE_assert(ctok, ctok);
@@ -339,7 +339,7 @@ exprEval(expr_t *pThis, msg_t *pMsg)
* rgerhards, 2008-02-09 (a rainy tenerife return flight day ;))
*/
rsRetVal
-exprGetStr(expr_t *pThis, rsCStrObj **ppStr)
+exprGetStr(expr_t *pThis, cstr_t **ppStr)
{
DEFiRet;
diff --git a/msg.c b/msg.c
index 505f878a..1241151e 100644
--- a/msg.c
+++ b/msg.c
@@ -1526,7 +1526,7 @@ static uchar *getNOW(eNOWType eNow)
* rgerhards 2005-09-15
*/
char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
- rsCStrObj *pCSPropName, unsigned short *pbMustBeFreed)
+ cstr_t *pCSPropName, unsigned short *pbMustBeFreed)
{
uchar *pName;
char *pRes; /* result pointer */
diff --git a/msg.h b/msg.h
index 91e3df89..b4135533 100644
--- a/msg.h
+++ b/msg.h
@@ -85,11 +85,11 @@ struct msg {
uchar *pszRcvFrom; /* System message was received from */
int iLenRcvFrom; /* Length of pszRcvFrom */
short iProtocolVersion;/* protocol version of message received 0 - legacy, 1 syslog-protocol) */
- rsCStrObj *pCSProgName; /* the (BSD) program name */
- rsCStrObj *pCSStrucData;/* STRUCTURED-DATA */
- rsCStrObj *pCSAPPNAME; /* APP-NAME */
- rsCStrObj *pCSPROCID; /* PROCID */
- rsCStrObj *pCSMSGID; /* MSGID */
+ cstr_t *pCSProgName; /* the (BSD) program name */
+ cstr_t *pCSStrucData;/* STRUCTURED-DATA */
+ cstr_t *pCSAPPNAME; /* APP-NAME */
+ cstr_t *pCSPROCID; /* PROCID */
+ cstr_t *pCSMSGID; /* MSGID */
struct syslogTime tRcvdAt;/* time the message entered this program */
char *pszRcvdAt3164; /* time as RFC3164 formatted string (always 15 charcters) */
char *pszRcvdAt3339; /* time as RFC3164 formatted string (32 charcters at most) */
@@ -152,7 +152,7 @@ void MsgSetRawMsg(msg_t *pMsg, char* pszRawMsg);
void moveHOSTNAMEtoTAG(msg_t *pM);
char *getMSGID(msg_t *pM);
char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
- rsCStrObj *pCSPropName, unsigned short *pbMustBeFreed);
+ cstr_t *pCSPropName, unsigned short *pbMustBeFreed);
char *textpri(char *pRes, size_t pResLen, int pri);
rsRetVal MsgEnableThreadSafety(void);
diff --git a/obj.c b/obj.c
index 417ca4ca..624cb58c 100644
--- a/obj.c
+++ b/obj.c
@@ -257,8 +257,8 @@ rsRetVal objSerializeProp(strm_t *pStrm, uchar *pszPropName, varType_t propType,
lenBuf = strlen((char*) szBuf);
break;
case VARTYPE_CSTR:
- pszBuf = rsCStrGetSzStrNoNULL((rsCStrObj *) pUsr);
- lenBuf = rsCStrLen((rsCStrObj*) pUsr);
+ pszBuf = rsCStrGetSzStrNoNULL((cstr_t *) pUsr);
+ lenBuf = rsCStrLen((cstr_t*) pUsr);
break;
case VARTYPE_SYSLOGTIME:
lenBuf = snprintf((char*) szBuf, sizeof(szBuf), "%d:%d:%d:%d:%d:%d:%d:%d:%d:%c:%d:%d",
@@ -353,12 +353,12 @@ finalize_it:
/* de-serialize a string, length must be provided */
-static rsRetVal objDeserializeStr(rsCStrObj **ppCStr, int iLen, strm_t *pStrm)
+static rsRetVal objDeserializeStr(cstr_t **ppCStr, int iLen, strm_t *pStrm)
{
DEFiRet;
int i;
uchar c;
- rsCStrObj *pCStr = NULL;
+ cstr_t *pCStr = NULL;
assert(ppCStr != NULL);
assert(iLen > 0);
diff --git a/outchannel.c b/outchannel.c
index debe3b43..9b669cb1 100644
--- a/outchannel.c
+++ b/outchannel.c
@@ -96,7 +96,7 @@ static void skip_Comma(char **pp)
static int get_Field(uchar **pp, uchar **pField)
{
register uchar *p;
- rsCStrObj *pStrB;
+ cstr_t *pStrB;
assert(pp != NULL);
assert(*pp != NULL);
@@ -161,7 +161,7 @@ static int get_off_t(uchar **pp, off_t *pOff_t)
static inline int get_restOfLine(uchar **pp, uchar **pBuf)
{
register uchar *p;
- rsCStrObj *pStrB;
+ cstr_t *pStrB;
assert(pp != NULL);
assert(*pp != NULL);
diff --git a/parse.c b/parse.c
index 75843286..bca6457d 100644
--- a/parse.c
+++ b/parse.c
@@ -91,7 +91,7 @@ rsRetVal rsParsConstructFromSz(rsParsObj **ppThis, unsigned char *psz)
{
DEFiRet;
rsParsObj *pThis;
- rsCStrObj *pCS;
+ cstr_t *pCS;
assert(ppThis != NULL);
assert(psz != NULL);
@@ -119,7 +119,7 @@ finalize_it:
/**
* Assign the to-be-parsed string.
*/
-rsRetVal rsParsAssignString(rsParsObj *pThis, rsCStrObj *pCStr)
+rsRetVal rsParsAssignString(rsParsObj *pThis, cstr_t *pCStr)
{
rsCHECKVALIDOBJECT(pThis, OIDrsPars);
rsCHECKVALIDOBJECT(pCStr, OIDrsCStr);
@@ -239,11 +239,11 @@ rsRetVal parsSkipWhitespace(rsParsObj *pThis)
* Output:
* ppCStr Pointer to the parsed string - must be freed by caller!
*/
-rsRetVal parsDelimCStr(rsParsObj *pThis, rsCStrObj **ppCStr, char cDelim, int bTrimLeading, int bTrimTrailing)
+rsRetVal parsDelimCStr(rsParsObj *pThis, cstr_t **ppCStr, char cDelim, int bTrimLeading, int bTrimTrailing)
{
DEFiRet;
register unsigned char *pC;
- rsCStrObj *pCStr;
+ cstr_t *pCStr;
rsCHECKVALIDOBJECT(pThis, OIDrsPars);
@@ -305,10 +305,10 @@ finalize_it:
* does NOT include the quotes.
* rgerhards, 2005-09-19
*/
-rsRetVal parsQuotedCStr(rsParsObj *pThis, rsCStrObj **ppCStr)
+rsRetVal parsQuotedCStr(rsParsObj *pThis, cstr_t **ppCStr)
{
register unsigned char *pC;
- rsCStrObj *pCStr;
+ cstr_t *pCStr;
DEFiRet;
rsCHECKVALIDOBJECT(pThis, OIDrsPars);
@@ -381,7 +381,7 @@ rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits)
uchar *pszIP;
uchar *pszTmp;
struct addrinfo hints, *res = NULL;
- rsCStrObj *pCStr;
+ cstr_t *pCStr;
DEFiRet;
rsCHECKVALIDOBJECT(pThis, OIDrsPars);
diff --git a/parse.h b/parse.h
index f3a064d1..483c109b 100644
--- a/parse.h
+++ b/parse.h
@@ -56,7 +56,7 @@ struct rsParsObject
#ifndef NDEBUG
rsObjID OID; /**< object ID */
#endif
- rsCStrObj *pCStr; /**< pointer to the string object we are parsing */
+ cstr_t *pCStr; /**< pointer to the string object we are parsing */
int iCurrPos; /**< current parsing position (char offset) */
};
typedef struct rsParsObject rsParsObj;
@@ -71,7 +71,7 @@ int rsParsGetParsePointer(rsParsObj *pThis);
* Construct a rsPars object.
*/
rsRetVal rsParsConstruct(rsParsObj **ppThis);
-rsRetVal rsParsAssignString(rsParsObj *pThis, rsCStrObj *pCStr);
+rsRetVal rsParsAssignString(rsParsObj *pThis, cstr_t *pCStr);
/* parse an integer. The parse pointer is advanced */
rsRetVal parsInt(rsParsObj *pThis, int* pInt);
@@ -91,10 +91,10 @@ rsRetVal parsSkipWhitespace(rsParsObj *pThis);
* Output:
* ppCStr Pointer to the parsed string
*/
-rsRetVal parsDelimCStr(rsParsObj *pThis, rsCStrObj **ppCStr, char cDelim, int bTrimLeading, int bTrimTrailing);
+rsRetVal parsDelimCStr(rsParsObj *pThis, cstr_t **ppCStr, char cDelim, int bTrimLeading, int bTrimTrailing);
rsRetVal parsSkipAfterChar(rsParsObj *pThis, char c);
-rsRetVal parsQuotedCStr(rsParsObj *pThis, rsCStrObj **ppCStr);
+rsRetVal parsQuotedCStr(rsParsObj *pThis, cstr_t **ppCStr);
rsRetVal rsParsConstructFromSz(rsParsObj **ppThis, unsigned char *psz);
rsRetVal rsParsDestruct(rsParsObj *pThis);
int parsIsAtEndOfParseString(rsParsObj *pThis);
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c
index 47df37f3..b3b2f060 100644
--- a/plugins/imfile/imfile.c
+++ b/plugins/imfile/imfile.c
@@ -79,7 +79,7 @@ typedef struct _instanceData {
/* enqueue the read file line as a message
*/
-static rsRetVal enqLine(fileInfo_t *pInfo, rsCStrObj *cstrLine)
+static rsRetVal enqLine(fileInfo_t *pInfo, cstr_t *cstrLine)
{
DEFiRet;
msg_t *pMsg;
@@ -165,7 +165,7 @@ finalize_it:
static rsRetVal pollFile(fileInfo_t *pThis, int *pbHadFileData)
{
DEFiRet;
- rsCStrObj *pCStr;
+ cstr_t *pCStr;
ASSERT(pbHadFileData != NULL);
diff --git a/stream.c b/stream.c
index 95506685..c622f331 100644
--- a/stream.c
+++ b/stream.c
@@ -348,11 +348,11 @@ rsRetVal strmUnreadChar(strm_t *pThis, uchar c)
* rgerhards, 2008-01-07
*/
rsRetVal
-strmReadLine(strm_t *pThis, rsCStrObj **ppCStr)
+strmReadLine(strm_t *pThis, cstr_t **ppCStr)
{
DEFiRet;
uchar c;
- rsCStrObj *pCStr = NULL;
+ cstr_t *pCStr = NULL;
ASSERT(pThis != NULL);
ASSERT(ppCStr != NULL);
diff --git a/stream.h b/stream.h
index 53bcc41e..dd8204e2 100644
--- a/stream.h
+++ b/stream.h
@@ -97,7 +97,7 @@ rsRetVal strmSetMaxFileSize(strm_t *pThis, int64 iMaxFileSize);
rsRetVal strmSetFileName(strm_t *pThis, uchar *pszName, size_t iLenName);
rsRetVal strmReadChar(strm_t *pThis, uchar *pC);
rsRetVal strmUnreadChar(strm_t *pThis, uchar c);
-rsRetVal strmReadLine(strm_t *pThis, rsCStrObj **ppCStr);
+rsRetVal strmReadLine(strm_t *pThis, cstr_t **ppCStr);
rsRetVal strmSeekCurrOffs(strm_t *pThis);
rsRetVal strmWrite(strm_t *pThis, uchar *pBuf, size_t lenBuf);
rsRetVal strmWriteChar(strm_t *pThis, uchar c);
diff --git a/stringbuf.c b/stringbuf.c
index 3e222a5f..a54fe1bd 100755
--- a/stringbuf.c
+++ b/stringbuf.c
@@ -50,14 +50,14 @@
* ################################################################# */
-rsRetVal rsCStrConstruct(rsCStrObj **ppThis)
+rsRetVal rsCStrConstruct(cstr_t **ppThis)
{
DEFiRet;
- rsCStrObj *pThis;
+ cstr_t *pThis;
ASSERT(ppThis != NULL);
- if((pThis = (rsCStrObj*) calloc(1, sizeof(rsCStrObj))) == NULL)
+ if((pThis = (cstr_t*) calloc(1, sizeof(cstr_t))) == NULL)
ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY);
rsSETOBJTYPE(pThis, OIDrsCStr);
@@ -76,10 +76,10 @@ finalize_it:
/* construct from sz string
* rgerhards 2005-09-15
*/
-rsRetVal rsCStrConstructFromszStr(rsCStrObj **ppThis, uchar *sz)
+rsRetVal rsCStrConstructFromszStr(cstr_t **ppThis, uchar *sz)
{
DEFiRet;
- rsCStrObj *pThis;
+ cstr_t *pThis;
assert(ppThis != NULL);
@@ -104,10 +104,10 @@ finalize_it:
* copied, not the szString.
* rgerhards 2005-10-18
*/
-rsRetVal rsCStrConstructFromCStr(rsCStrObj **ppThis, rsCStrObj *pFrom)
+rsRetVal rsCStrConstructFromCStr(cstr_t **ppThis, cstr_t *pFrom)
{
DEFiRet;
- rsCStrObj *pThis;
+ cstr_t *pThis;
assert(ppThis != NULL);
rsCHECKVALIDOBJECT(pFrom, OIDrsCStr);
@@ -129,9 +129,9 @@ finalize_it:
}
-void rsCStrDestruct(rsCStrObj **ppThis)
+void rsCStrDestruct(cstr_t **ppThis)
{
- rsCStrObj *pThis = *ppThis;
+ cstr_t *pThis = *ppThis;
/* rgerhards 2005-10-19: The free of pBuf was contained in conditional compilation.
* The code was only compiled if STRINGBUF_TRIM_ALLOCSIZE was set to 1. I honestly
@@ -163,7 +163,7 @@ void rsCStrDestruct(rsCStrObj **ppThis)
* some more characters may be added after these.
* rgerhards, 2008-01-07
*/
-static rsRetVal rsCStrExtendBuf(rsCStrObj *pThis, size_t iMinNeeded)
+static rsRetVal rsCStrExtendBuf(cstr_t *pThis, size_t iMinNeeded)
{
DEFiRet;
uchar *pNewBuf;
@@ -204,7 +204,7 @@ finalize_it:
* I optimized this function to use memcpy(), among others. Consider it a
* rewrite (which may be good to know in case of bugs) -- rgerhards, 2008-01-07
*/
-rsRetVal rsCStrAppendStrWithLen(rsCStrObj *pThis, uchar* psz, size_t iStrLen)
+rsRetVal rsCStrAppendStrWithLen(cstr_t *pThis, uchar* psz, size_t iStrLen)
{
DEFiRet;
@@ -230,13 +230,13 @@ finalize_it:
* need to change existing code.
* rgerhards, 2007-07-03
*/
-rsRetVal rsCStrAppendStr(rsCStrObj *pThis, uchar* psz)
+rsRetVal rsCStrAppendStr(cstr_t *pThis, uchar* psz)
{
return rsCStrAppendStrWithLen(pThis, psz, strlen((char*) psz));
}
-rsRetVal rsCStrAppendInt(rsCStrObj *pThis, long i)
+rsRetVal rsCStrAppendInt(cstr_t *pThis, long i)
{
DEFiRet;
uchar szBuf[32];
@@ -251,7 +251,7 @@ finalize_it:
}
-rsRetVal rsCStrAppendChar(rsCStrObj *pThis, uchar c)
+rsRetVal rsCStrAppendChar(cstr_t *pThis, uchar c)
{
DEFiRet;
@@ -282,7 +282,7 @@ finalize_it:
* not modified by this function.
* rgerhards, 2005-10-18
*/
-rsRetVal rsCStrSetSzStr(rsCStrObj *pThis, uchar *pszNew)
+rsRetVal rsCStrSetSzStr(cstr_t *pThis, uchar *pszNew)
{
rsCHECKVALIDOBJECT(pThis, OIDrsCStr);
@@ -323,7 +323,7 @@ rsRetVal rsCStrSetSzStr(rsCStrObj *pThis, uchar *pszNew)
* WARNING: The returned pointer MUST NOT be freed, as it may be
* obtained from that constant memory pool (in case of NULL!)
*/
-uchar* rsCStrGetSzStrNoNULL(rsCStrObj *pThis)
+uchar* rsCStrGetSzStrNoNULL(cstr_t *pThis)
{
rsCHECKVALIDOBJECT(pThis, OIDrsCStr);
if(pThis->pBuf == NULL)
@@ -341,7 +341,7 @@ uchar* rsCStrGetSzStrNoNULL(rsCStrObj *pThis)
* rsCStrGetSzStrNoNULL() instead.
* rgerhards, 2005-09-15
*/
-uchar* rsCStrGetSzStr(rsCStrObj *pThis)
+uchar* rsCStrGetSzStr(cstr_t *pThis)
{
size_t i;
@@ -405,7 +405,7 @@ uchar* rsCStrGetSzStr(rsCStrObj *pThis)
* PLEASE NOTE: the caller must free the memory returned in ppSz in any case
* (except, of course, if it is NULL).
*/
-rsRetVal rsCStrConvSzStrAndDestruct(rsCStrObj *pThis, uchar **ppSz, int bRetNULL)
+rsRetVal rsCStrConvSzStrAndDestruct(cstr_t *pThis, uchar **ppSz, int bRetNULL)
{
DEFiRet;
uchar* pRetBuf;
@@ -459,7 +459,7 @@ finalize_it:
* tested the fix. So if you intend to use this feature, you must
* do full testing before you rely on it. -- rgerhards, 2008-02-12
*/
-rsRetVal rsCStrFinish(rsCStrObj __attribute__((unused)) *pThis)
+rsRetVal rsCStrFinish(cstr_t __attribute__((unused)) *pThis)
{
DEFiRet;
uchar* pBuf;
@@ -481,7 +481,7 @@ rsRetVal rsCStrFinish(rsCStrObj __attribute__((unused)) *pThis)
#endif /* #if STRINGBUF_TRIM_ALLOCSIZE == 1 */
-void rsCStrSetAllocIncrement(rsCStrObj *pThis, int iNewIncrement)
+void rsCStrSetAllocIncrement(cstr_t *pThis, int iNewIncrement)
{
rsCHECKVALIDOBJECT(pThis, OIDrsCStr);
assert(iNewIncrement > 0);
@@ -497,7 +497,7 @@ void rsCStrSetAllocIncrement(rsCStrObj *pThis, int iNewIncrement)
* This is due to performance reasons.
*/
#ifndef NDEBUG
-int rsCStrLen(rsCStrObj *pThis)
+int rsCStrLen(cstr_t *pThis)
{
rsCHECKVALIDOBJECT(pThis, OIDrsCStr);
return(pThis->iStrLen);
@@ -507,7 +507,7 @@ int rsCStrLen(rsCStrObj *pThis)
/* Truncate characters from the end of the string.
* rgerhards 2005-09-15
*/
-rsRetVal rsCStrTruncate(rsCStrObj *pThis, size_t nTrunc)
+rsRetVal rsCStrTruncate(cstr_t *pThis, size_t nTrunc)
{
rsCHECKVALIDOBJECT(pThis, OIDrsCStr);
@@ -530,7 +530,7 @@ rsRetVal rsCStrTruncate(rsCStrObj *pThis, size_t nTrunc)
/* Trim trailing whitespace from a given string
*/
-rsRetVal rsCStrTrimTrailingWhiteSpace(rsCStrObj *pThis)
+rsRetVal rsCStrTrimTrailingWhiteSpace(cstr_t *pThis)
{
register int i;
register uchar *pC;
@@ -557,7 +557,7 @@ rsRetVal rsCStrTrimTrailingWhiteSpace(rsCStrObj *pThis)
* in equal-size strings.
* rgerhards, 2005-09-26
*/
-int rsCStrCStrCmp(rsCStrObj *pCS1, rsCStrObj *pCS2)
+int rsCStrCStrCmp(cstr_t *pCS1, cstr_t *pCS2)
{
rsCHECKVALIDOBJECT(pCS1, OIDrsCStr);
rsCHECKVALIDOBJECT(pCS2, OIDrsCStr);
@@ -586,7 +586,7 @@ int rsCStrCStrCmp(rsCStrObj *pCS1, rsCStrObj *pCS2)
* comparison operation. Maybe it also has other needs.
* rgerhards 2005-10-19
*/
-int rsCStrSzStrStartsWithCStr(rsCStrObj *pCS1, uchar *psz, size_t iLenSz)
+int rsCStrSzStrStartsWithCStr(cstr_t *pCS1, uchar *psz, size_t iLenSz)
{
register int i;
int iMax;
@@ -618,7 +618,7 @@ int rsCStrSzStrStartsWithCStr(rsCStrObj *pCS1, uchar *psz, size_t iLenSz)
/* check if a CStr object starts with a sz-type string.
* rgerhards 2005-09-26
*/
-int rsCStrStartsWithSzStr(rsCStrObj *pCS1, uchar *psz, size_t iLenSz)
+int rsCStrStartsWithSzStr(cstr_t *pCS1, uchar *psz, size_t iLenSz)
{
register size_t i;
@@ -651,7 +651,7 @@ int rsCStrStartsWithSzStr(rsCStrObj *pCS1, uchar *psz, size_t iLenSz)
* rgerhards, 2007-07-16: bug is no real bug, because rsyslogd ensures there
* never is a \0 *inside* a property string.
*/
-int rsCStrSzStrMatchRegex(rsCStrObj *pCS1, uchar *psz)
+int rsCStrSzStrMatchRegex(cstr_t *pCS1, uchar *psz)
{
regex_t preq;
BEGINfunc
@@ -683,7 +683,7 @@ int rsCStrSzStrMatchRegex(rsCStrObj *pCS1, uchar *psz)
* program bug and will lead to unpredictable results and program aborts).
* rgerhards 2005-09-26
*/
-int rsCStrOffsetSzStrCmp(rsCStrObj *pCS1, size_t iOffset, uchar *psz, size_t iLenSz)
+int rsCStrOffsetSzStrCmp(cstr_t *pCS1, size_t iOffset, uchar *psz, size_t iLenSz)
{
BEGINfunc
rsCHECKVALIDOBJECT(pCS1, OIDrsCStr);
@@ -731,7 +731,7 @@ int rsCStrOffsetSzStrCmp(rsCStrObj *pCS1, size_t iOffset, uchar *psz, size_t iLe
* The to sz string pointer must not be NULL!
* rgerhards 2005-09-26
*/
-int rsCStrSzStrCmp(rsCStrObj *pCS1, uchar *psz, size_t iLenSz)
+int rsCStrSzStrCmp(cstr_t *pCS1, uchar *psz, size_t iLenSz)
{
rsCHECKVALIDOBJECT(pCS1, OIDrsCStr);
assert(psz != NULL);
@@ -764,7 +764,7 @@ int rsCStrSzStrCmp(rsCStrObj *pCS1, uchar *psz, size_t iLenSz)
* returned. Both parameters MUST be given (NULL is not allowed).
* rgerhards 2005-09-19
*/
-int rsCStrLocateInSzStr(rsCStrObj *pThis, uchar *sz)
+int rsCStrLocateInSzStr(cstr_t *pThis, uchar *sz)
{
int i;
int iMax;
@@ -809,7 +809,7 @@ int rsCStrLocateInSzStr(rsCStrObj *pThis, uchar *sz)
* some time later. However, it is not fully tested, so start with testing
* it before you put it to first use).
*/
-int rsCStrLocateSzStr(rsCStrObj *pThis, uchar *sz)
+int rsCStrLocateSzStr(cstr_t *pThis, uchar *sz)
{
int iLenSz;
int i;
diff --git a/stringbuf.h b/stringbuf.h
index 779e05eb..1c4ff04b 100755
--- a/stringbuf.h
+++ b/stringbuf.h
@@ -1,160 +1,159 @@
-/*! \file stringbuf.h
- * \brief The counted string object
- *
- * This is the byte-counted string class for rsyslog. It is a replacement
- * for classical \0 terminated string functions. We introduce it in
- * the hope it will make the program more secure, obtain some performance
- * and, most importantly, lay they foundation for syslog-protocol, which
- * requires strings to be able to handle embedded \0 characters.
- *
- * \author Rainer Gerhards <rgerhards@adiscon.com>
- * \date 2005-09-07
- * Initial version begun.
- *
- * All functions in this "class" start with rsCStr (rsyslog Counted String).
- * Copyright 2005
- * Rainer Gerhards and Adiscon GmbH. All Rights Reserved.
- *
- * This file is part of rsyslog.
- *
- * Rsyslog is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Rsyslog is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Rsyslog. If not, see <http://www.gnu.org/licenses/>.
- *
- * A copy of the GPL can be found in the file "COPYING" in this distribution.
- */
-#ifndef _STRINGBUF_H_INCLUDED__
-#define _STRINGBUF_H_INCLUDED__ 1
-
-/**
- * The dynamic string buffer object.
- */
-struct rsCStrObject
-{
-#ifndef NDEBUG
- rsObjID OID; /**< object ID */
-#endif
- uchar *pBuf; /**< pointer to the string buffer, may be NULL if string is empty */
- uchar *pszBuf; /**< pointer to the sz version of the string (after it has been created )*/
- size_t iBufSize; /**< current maximum size of the string buffer */
- size_t iStrLen; /**< length of the string in characters. */
- size_t iAllocIncrement; /**< the amount of bytes the string should be expanded if it needs to */
-};
-typedef struct rsCStrObject rsCStrObj;
-
-
-/**
- * Construct a rsCStr object.
- */
-rsRetVal rsCStrConstruct(rsCStrObj **ppThis);
-rsRetVal rsCStrConstructFromszStr(rsCStrObj **ppThis, uchar *sz);
-rsRetVal rsCStrConstructFromCStr(rsCStrObj **ppThis, rsCStrObj *pFrom);
-
-/**
- * Destruct the string buffer object.
- */
-void rsCStrDestruct(rsCStrObj **ppThis);
-
-/**
- * Append a character to an existing string. If necessary, the
- * method expands the string buffer.
- *
- * \param c Character to append to string.
- */
-rsRetVal rsCStrAppendChar(rsCStrObj *pThis, uchar c);
-
-/**
- * Finish the string buffer dynamic allocation.
- */
-rsRetVal rsCStrFinish(rsCStrObj *pThis);
-
-/**
- * Truncate "n" number of characters from the end of the
- * string. The buffer remains unchanged, just the
- * string length is manipulated. This is for performance
- * reasons.
- */
-rsRetVal rsCStrTruncate(rsCStrObj *pThis, size_t nTrunc);
-
-rsRetVal rsCStrTrimTrailingWhiteSpace(rsCStrObj *pThis);
-
-/**
- * Append a string to the buffer. For performance reasons,
- * use rsCStrAppenStrWithLen() if you know the length.
- *
- * \param psz pointer to string to be appended. Must not be NULL.
- */
-rsRetVal rsCStrAppendStr(rsCStrObj *pThis, uchar* psz);
-
-/**
- * Append a string to the buffer.
- *
- * \param psz pointer to string to be appended. Must not be NULL.
- * \param iStrLen the length of the string pointed to by psz
- */
-rsRetVal rsCStrAppendStrWithLen(rsCStrObj *pThis, uchar* psz, size_t iStrLen);
-
-/**
- * Set a new allocation incremet. This will influence
- * the allocation the next time the string will be expanded.
- * It can be set and changed at any time. If done immediately
- * after custructing the StrB object, this will also be
- * the inital allocation.
- *
- * \param iNewIncrement The new increment size
- *
- * \note It is possible to use a very low increment, e.g. 1 byte.
- * This can generate a considerable overhead. We highly
- * advise not to use an increment below 32 bytes, except
- * if you are very well aware why you are doing it ;)
- */
-void rsCStrSetAllocIncrement(rsCStrObj *pThis, int iNewIncrement);
-#define rsCStrGetAllocIncrement(pThis) ((pThis)->iAllocIncrement)
-
-/**
- * Append an integer to the string. No special formatting is
- * done.
- */
-rsRetVal rsCStrAppendInt(rsCStrObj *pThis, long i);
-
-
-uchar* rsCStrGetSzStr(rsCStrObj *pThis);
-uchar* rsCStrGetSzStrNoNULL(rsCStrObj *pThis);
-rsRetVal rsCStrSetSzStr(rsCStrObj *pThis, uchar *pszNew);
-rsRetVal rsCStrConvSzStrAndDestruct(rsCStrObj *pThis, uchar **ppSz, int bRetNULL);
-int rsCStrCStrCmp(rsCStrObj *pCS1, rsCStrObj *pCS2);
-int rsCStrSzStrCmp(rsCStrObj *pCS1, uchar *psz, size_t iLenSz);
-int rsCStrOffsetSzStrCmp(rsCStrObj *pCS1, size_t iOffset, uchar *psz, size_t iLenSz);
-int rsCStrLocateSzStr(rsCStrObj *pCStr, uchar *sz);
-int rsCStrLocateInSzStr(rsCStrObj *pThis, uchar *sz);
-int rsCStrStartsWithSzStr(rsCStrObj *pCS1, uchar *psz, size_t iLenSz);
-int rsCStrSzStrStartsWithCStr(rsCStrObj *pCS1, uchar *psz, size_t iLenSz);
-int rsCStrSzStrMatchRegex(rsCStrObj *pCS1, uchar *psz);
-
-/* now come inline-like functions */
-#ifdef NDEBUG
-# define rsCStrLen(x) ((int)((x)->iStrLen))
-#else
- int rsCStrLen(rsCStrObj *pThis);
-#endif
-
-#if STRINGBUF_TRIM_ALLOCSIZE != 1
-/* This is the normal case (see comment in rsCStrFinish!). In those cases, the function
- * simply needs to do nothing, so that we can save us the function call.
- * rgerhards, 2008-02-12
- */
-#define rsCStrFinish(pThis) RS_RET_OK
-#endif
-
-#define rsCStrGetBufBeg(x) ((x)->pBuf)
-
-#endif /* single include */
+/*! \file stringbuf.h
+ * \brief The counted string object
+ *
+ * This is the byte-counted string class for rsyslog. It is a replacement
+ * for classical \0 terminated string functions. We introduce it in
+ * the hope it will make the program more secure, obtain some performance
+ * and, most importantly, lay they foundation for syslog-protocol, which
+ * requires strings to be able to handle embedded \0 characters.
+ *
+ * \author Rainer Gerhards <rgerhards@adiscon.com>
+ * \date 2005-09-07
+ * Initial version begun.
+ *
+ * All functions in this "class" start with rsCStr (rsyslog Counted String).
+ * Copyright 2005
+ * Rainer Gerhards and Adiscon GmbH. All Rights Reserved.
+ *
+ * This file is part of rsyslog.
+ *
+ * Rsyslog is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Rsyslog is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Rsyslog. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * A copy of the GPL can be found in the file "COPYING" in this distribution.
+ */
+#ifndef _STRINGBUF_H_INCLUDED__
+#define _STRINGBUF_H_INCLUDED__ 1
+
+/**
+ * The dynamic string buffer object.
+ */
+typedef struct cstr_s
+{
+#ifndef NDEBUG
+ rsObjID OID; /**< object ID */
+#endif
+ uchar *pBuf; /**< pointer to the string buffer, may be NULL if string is empty */
+ uchar *pszBuf; /**< pointer to the sz version of the string (after it has been created )*/
+ size_t iBufSize; /**< current maximum size of the string buffer */
+ size_t iStrLen; /**< length of the string in characters. */
+ size_t iAllocIncrement; /**< the amount of bytes the string should be expanded if it needs to */
+} cstr_t;
+
+
+/**
+ * Construct a rsCStr object.
+ */
+rsRetVal rsCStrConstruct(cstr_t **ppThis);
+rsRetVal rsCStrConstructFromszStr(cstr_t **ppThis, uchar *sz);
+rsRetVal rsCStrConstructFromCStr(cstr_t **ppThis, cstr_t *pFrom);
+
+/**
+ * Destruct the string buffer object.
+ */
+void rsCStrDestruct(cstr_t **ppThis);
+
+/**
+ * Append a character to an existing string. If necessary, the
+ * method expands the string buffer.
+ *
+ * \param c Character to append to string.
+ */
+rsRetVal rsCStrAppendChar(cstr_t *pThis, uchar c);
+
+/**
+ * Finish the string buffer dynamic allocation.
+ */
+rsRetVal rsCStrFinish(cstr_t *pThis);
+
+/**
+ * Truncate "n" number of characters from the end of the
+ * string. The buffer remains unchanged, just the
+ * string length is manipulated. This is for performance
+ * reasons.
+ */
+rsRetVal rsCStrTruncate(cstr_t *pThis, size_t nTrunc);
+
+rsRetVal rsCStrTrimTrailingWhiteSpace(cstr_t *pThis);
+
+/**
+ * Append a string to the buffer. For performance reasons,
+ * use rsCStrAppenStrWithLen() if you know the length.
+ *
+ * \param psz pointer to string to be appended. Must not be NULL.
+ */
+rsRetVal rsCStrAppendStr(cstr_t *pThis, uchar* psz);
+
+/**
+ * Append a string to the buffer.
+ *
+ * \param psz pointer to string to be appended. Must not be NULL.
+ * \param iStrLen the length of the string pointed to by psz
+ */
+rsRetVal rsCStrAppendStrWithLen(cstr_t *pThis, uchar* psz, size_t iStrLen);
+
+/**
+ * Set a new allocation incremet. This will influence
+ * the allocation the next time the string will be expanded.
+ * It can be set and changed at any time. If done immediately
+ * after custructing the StrB object, this will also be
+ * the inital allocation.
+ *
+ * \param iNewIncrement The new increment size
+ *
+ * \note It is possible to use a very low increment, e.g. 1 byte.
+ * This can generate a considerable overhead. We highly
+ * advise not to use an increment below 32 bytes, except
+ * if you are very well aware why you are doing it ;)
+ */
+void rsCStrSetAllocIncrement(cstr_t *pThis, int iNewIncrement);
+#define rsCStrGetAllocIncrement(pThis) ((pThis)->iAllocIncrement)
+
+/**
+ * Append an integer to the string. No special formatting is
+ * done.
+ */
+rsRetVal rsCStrAppendInt(cstr_t *pThis, long i);
+
+
+uchar* rsCStrGetSzStr(cstr_t *pThis);
+uchar* rsCStrGetSzStrNoNULL(cstr_t *pThis);
+rsRetVal rsCStrSetSzStr(cstr_t *pThis, uchar *pszNew);
+rsRetVal rsCStrConvSzStrAndDestruct(cstr_t *pThis, uchar **ppSz, int bRetNULL);
+int rsCStrCStrCmp(cstr_t *pCS1, cstr_t *pCS2);
+int rsCStrSzStrCmp(cstr_t *pCS1, uchar *psz, size_t iLenSz);
+int rsCStrOffsetSzStrCmp(cstr_t *pCS1, size_t iOffset, uchar *psz, size_t iLenSz);
+int rsCStrLocateSzStr(cstr_t *pCStr, uchar *sz);
+int rsCStrLocateInSzStr(cstr_t *pThis, uchar *sz);
+int rsCStrStartsWithSzStr(cstr_t *pCS1, uchar *psz, size_t iLenSz);
+int rsCStrSzStrStartsWithCStr(cstr_t *pCS1, uchar *psz, size_t iLenSz);
+int rsCStrSzStrMatchRegex(cstr_t *pCS1, uchar *psz);
+
+/* now come inline-like functions */
+#ifdef NDEBUG
+# define rsCStrLen(x) ((int)((x)->iStrLen))
+#else
+ int rsCStrLen(cstr_t *pThis);
+#endif
+
+#if STRINGBUF_TRIM_ALLOCSIZE != 1
+/* This is the normal case (see comment in rsCStrFinish!). In those cases, the function
+ * simply needs to do nothing, so that we can save us the function call.
+ * rgerhards, 2008-02-12
+ */
+#define rsCStrFinish(pThis) RS_RET_OK
+#endif
+
+#define rsCStrGetBufBeg(x) ((x)->pBuf)
+
+#endif /* single include */
diff --git a/syslogd.c b/syslogd.c
index 72f1f793..1f5d885c 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -1857,7 +1857,7 @@ static int parseLegacySyslogMsg(msg_t *pMsg, int flags)
char *p2parse;
char *pBuf;
char *pWork;
- rsCStrObj *pStrB;
+ cstr_t *pStrB;
int iCnt;
int bTAGCharDetected;
diff --git a/syslogd.h b/syslogd.h
index d2dd37fe..31b35609 100644
--- a/syslogd.h
+++ b/syslogd.h
@@ -77,12 +77,12 @@ struct filed {
FILTER_EXPR = 2 /* extended filter, expression based */
} f_filter_type;
EHostnameCmpMode eHostnameCmpMode;
- rsCStrObj *pCSHostnameComp; /* hostname to check */
- rsCStrObj *pCSProgNameComp; /* tag to check or NULL, if not to be checked */
+ cstr_t *pCSHostnameComp; /* hostname to check */
+ cstr_t *pCSProgNameComp; /* tag to check or NULL, if not to be checked */
union {
u_char f_pmask[LOG_NFACILITIES+1]; /* priority mask */
struct {
- rsCStrObj *pCSPropName;
+ cstr_t *pCSPropName;
enum {
FIOP_NOP = 0, /* do not use - No Operation */
FIOP_CONTAINS = 1, /* contains string? */
@@ -90,7 +90,7 @@ struct filed {
FIOP_STARTSWITH = 3, /* starts with a string? */
FIOP_REGEX = 4 /* matches a regular expression? */
} operation;
- rsCStrObj *pCSCompValue; /* value to "compare" against */
+ cstr_t *pCSCompValue; /* value to "compare" against */
char isNegated; /* actually a boolean ;) */
} prop;
expr_t *f_expr; /* expression object */
diff --git a/template.c b/template.c
index 36cc30a3..c28dc53e 100644
--- a/template.c
+++ b/template.c
@@ -64,7 +64,7 @@ rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar** ppSz)
{
DEFiRet;
struct templateEntry *pTpe;
- rsCStrObj *pCStr;
+ cstr_t *pCStr;
unsigned short bMustBeFreed;
uchar *pVal;
size_t iLenVal;
@@ -184,7 +184,7 @@ void doSQLEscape(uchar **pp, size_t *pLen, unsigned short *pbMustBeFreed, int es
{
uchar *p;
int iLen;
- rsCStrObj *pStrB;
+ cstr_t *pStrB;
uchar *pszGenerated;
assert(pp != NULL);
@@ -310,7 +310,7 @@ struct template* tplConstruct(void)
static int do_Constant(unsigned char **pp, struct template *pTpl)
{
register unsigned char *p;
- rsCStrObj *pStrB;
+ cstr_t *pStrB;
struct templateEntry *pTpe;
int i;
@@ -473,7 +473,7 @@ static void doOptions(unsigned char **pp, struct templateEntry *pTpe)
static int do_Parameter(unsigned char **pp, struct template *pTpl)
{
unsigned char *p;
- rsCStrObj *pStrB;
+ cstr_t *pStrB;
struct templateEntry *pTpe;
int iNum; /* to compute numbers */
diff --git a/var.c b/var.c
index 1da99cda..26c2218f 100644
--- a/var.c
+++ b/var.c
@@ -105,7 +105,7 @@ varUnsetValues(var_t *pThis)
/* set a string value
*/
rsRetVal
-varSetString(var_t *pThis, rsCStrObj *pCStr)
+varSetString(var_t *pThis, cstr_t *pCStr)
{
DEFiRet;
diff --git a/var.h b/var.h
index b497e410..c02b93b2 100644
--- a/var.h
+++ b/var.h
@@ -38,13 +38,13 @@ typedef enum {
/* the var object */
typedef struct var_s {
BEGINobjInstance; /* Data to implement generic object - MUST be the first data element! */
- rsCStrObj *pcsName;
+ cstr_t *pcsName;
varType_t varType;
union {
short vShort;
int vInt;
long vLong;
- rsCStrObj *vpCStr; /* used for both rsCStr and psz */
+ cstr_t *vpCStr; /* used for both rsCStr and psz */
syslogTime_t vSyslogTime;
} val;
@@ -55,7 +55,7 @@ typedef struct var_s {
rsRetVal varConstruct(var_t **ppThis);
rsRetVal varConstructFinalize(var_t __attribute__((unused)) *pThis);
rsRetVal varDestruct(var_t **ppThis);
-rsRetVal varSetString(var_t *pThis, rsCStrObj *pCStr);
+rsRetVal varSetString(var_t *pThis, cstr_t *pCStr);
PROTOTYPEObjClassInit(var);
PROTOTYPEObjDebugPrint(var);