summaryrefslogtreecommitdiff
path: root/runtime/stringbuf.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2014-03-13 17:57:11 +0100
committerMichael Biebl <biebl@debian.org>2014-03-13 17:57:11 +0100
commit29867b5cc18d25191fbbdcc4af4f79cc3a4da43e (patch)
tree1ffedd33b2a2e167aeb4b01a6c5c72aeb98a1b90 /runtime/stringbuf.c
parent5fccf771f37973a2cea543fbdf1ed94ed9706faf (diff)
downloadrsyslog-29867b5cc18d25191fbbdcc4af4f79cc3a4da43e.tar.gz
Imported Upstream version 7.6.1upstream/7.6.1
Diffstat (limited to 'runtime/stringbuf.c')
-rw-r--r--runtime/stringbuf.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/runtime/stringbuf.c b/runtime/stringbuf.c
index 13f3871..97bfed4 100644
--- a/runtime/stringbuf.c
+++ b/runtime/stringbuf.c
@@ -528,26 +528,6 @@ rsRetVal rsCStrTruncate(cstr_t *pThis, size_t nTrunc)
/* Trim trailing whitespace from a given string
*/
-rsRetVal rsCStrTrimTrailingWhiteSpace(cstr_t *pThis)
-{
- register int i;
- register uchar *pC;
- rsCHECKVALIDOBJECT(pThis, OIDrsCStr);
-
- i = pThis->iStrLen;
- pC = pThis->pBuf + i - 1;
- while(i > 0 && isspace((int)*pC)) {
- --pC;
- --i;
- }
- /* i now is the new string length! */
- pThis->iStrLen = i;
-
- return RS_RET_OK;
-}
-
-/* Trim trailing whitespace from a given string
- */
rsRetVal cstrTrimTrailingWhiteSpace(cstr_t *pThis)
{
register int i;
@@ -563,8 +543,10 @@ rsRetVal cstrTrimTrailingWhiteSpace(cstr_t *pThis)
--i;
}
/* i now is the new string length! */
- pThis->iStrLen = i;
- pThis->pBuf[pThis->iStrLen] = '\0'; /* we always have this space */
+ if(i != (int) pThis->iStrLen) {
+ pThis->iStrLen = i;
+ pThis->pBuf[pThis->iStrLen] = '\0'; /* we always have this space */
+ }
done: return RS_RET_OK;
}