summaryrefslogtreecommitdiffstats
path: root/stringbuf.c
diff options
context:
space:
mode:
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;