summaryrefslogtreecommitdiffstats
path: root/stringbuf.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-03 12:39:13 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-03 12:39:13 +0000
commit53c1a7305e119b397c3e80acfdd4a6aecc7ce121 (patch)
treea2236297ee385d7b06e347fd9c3bd9c581f2b957 /stringbuf.c
parent4c0e6b5073d9778688f4ef995bb3198ce9082c50 (diff)
downloadrsyslog-53c1a7305e119b397c3e80acfdd4a6aecc7ce121.tar.gz
rsyslog-53c1a7305e119b397c3e80acfdd4a6aecc7ce121.tar.xz
rsyslog-53c1a7305e119b397c3e80acfdd4a6aecc7ce121.zip
added support for dynamic file names in selector lines. Can now be created
with templates.
Diffstat (limited to 'stringbuf.c')
-rwxr-xr-xstringbuf.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/stringbuf.c b/stringbuf.c
index 5aa94fc4..fa26dc09 100755
--- a/stringbuf.c
+++ b/stringbuf.c
@@ -118,14 +118,14 @@ void rsCStrDestruct(rsCStrObj *pThis)
}
-rsRetVal rsCStrAppendStr(rsCStrObj *pThis, char* psz)
+rsRetVal rsCStrAppendStrWithLen(rsCStrObj *pThis, char* psz, size_t iStrLen)
{
rsRetVal iRet;
int iOldAllocInc;
- int iStrLen;
rsCHECKVALIDOBJECT(pThis, OIDrsCStr);
assert(psz != NULL);
+ assert(iStrLen >= 0);
/* we first check if the to-be-added string is larger than the
* alloc increment. If so, we temporarily increase the alloc
@@ -139,7 +139,7 @@ rsRetVal rsCStrAppendStr(rsCStrObj *pThis, char* psz)
* overwrite it below, this is faster than any if-construct.
*/
iOldAllocInc = pThis->iAllocIncrement;
- if((iStrLen = strlen(psz)) > pThis->iAllocIncrement) {
+ if(iStrLen > pThis->iAllocIncrement) {
pThis->iAllocIncrement = iStrLen;
}
@@ -152,6 +152,17 @@ rsRetVal rsCStrAppendStr(rsCStrObj *pThis, char* psz)
}
+/* changed to be a wrapper to rsCStrAppendStrWithLen() so that
+ * we can save some time when we have the length but do not
+ * need to change existing code.
+ * rgerhards, 2007-07-03
+ */
+rsRetVal rsCStrAppendStr(rsCStrObj *pThis, char* psz)
+{
+ return rsCStrAppendStrWithLen(pThis, psz, strlen(psz));
+}
+
+
rsRetVal rsCStrAppendInt(rsCStrObj *pThis, int i)
{
rsRetVal iRet;