diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-10-18 09:38:14 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-10-18 09:38:14 +0200 |
commit | fa8ff7601de0340fbc0d3892b418a5dbb32a6e24 (patch) | |
tree | e67abaf229573f22f51a20ab1a07f201f10746ed /runtime/stringbuf.c | |
parent | e4549c381ca5f4afd5b8abef3c597375d39cac9f (diff) | |
download | rsyslog-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.c | 6 |
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; } |