summaryrefslogtreecommitdiffstats
path: root/runtime/stringbuf.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-10-18 09:38:14 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2013-10-18 09:38:14 +0200
commitfa8ff7601de0340fbc0d3892b418a5dbb32a6e24 (patch)
treee67abaf229573f22f51a20ab1a07f201f10746ed /runtime/stringbuf.c
parente4549c381ca5f4afd5b8abef3c597375d39cac9f (diff)
downloadrsyslog-fa8ff7601de0340fbc0d3892b418a5dbb32a6e24.tar.gz
rsyslog-fa8ff7601de0340fbc0d3892b418a5dbb32a6e24.tar.bz2
rsyslog-fa8ff7601de0340fbc0d3892b418a5dbb32a6e24.zip
slight optimizations: avoid unnecessary writes
but this happens only during config load, so no real gain
Diffstat (limited to 'runtime/stringbuf.c')
-rw-r--r--runtime/stringbuf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/runtime/stringbuf.c b/runtime/stringbuf.c
index b35fe4ef..6079e685 100644
--- a/runtime/stringbuf.c
+++ b/runtime/stringbuf.c
@@ -543,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 != pThis->iStrLen) {
+ pThis->iStrLen = i;
+ pThis->pBuf[pThis->iStrLen] = '\0'; /* we always have this space */
+ }
done: return RS_RET_OK;
}