From 53c1a7305e119b397c3e80acfdd4a6aecc7ce121 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 3 Jul 2007 12:39:13 +0000 Subject: added support for dynamic file names in selector lines. Can now be created with templates. --- stringbuf.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'stringbuf.c') 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; -- cgit v1.2.3