diff options
author | Michael Biebl <biebl@debian.org> | 2012-11-16 17:43:41 +0100 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2012-11-16 17:43:41 +0100 |
commit | 792f31fe29bef0c9960d3951f266fc7b2c70a2fc (patch) | |
tree | e82d85662e0ba5fc7e4ed0838011ea2a0ac0b44b /runtime/stringbuf.c | |
parent | 05bd88b115965e17631a4af10c84d71622fe4e3d (diff) | |
download | rsyslog-792f31fe29bef0c9960d3951f266fc7b2c70a2fc.tar.gz |
Imported Upstream version 7.2.2upstream/7.2.2
Diffstat (limited to 'runtime/stringbuf.c')
-rw-r--r-- | runtime/stringbuf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/stringbuf.c b/runtime/stringbuf.c index e7fd72c..5bca009 100644 --- a/runtime/stringbuf.c +++ b/runtime/stringbuf.c @@ -482,6 +482,8 @@ rsRetVal cstrTrimTrailingWhiteSpace(cstr_t *pThis) register uchar *pC; rsCHECKVALIDOBJECT(pThis, OIDrsCStr); + if(pThis->iStrLen == 0) + goto done; /* empty string -> nothing to trim ;) */ i = pThis->iStrLen; pC = pThis->pBuf + i - 1; while(i > 0 && isspace((int)*pC)) { @@ -492,7 +494,7 @@ rsRetVal cstrTrimTrailingWhiteSpace(cstr_t *pThis) pThis->iStrLen = i; pThis->pBuf[pThis->iStrLen] = '0'; /* we always have this space */ - return RS_RET_OK; +done: return RS_RET_OK; } /* compare two string objects - works like strcmp(), but operates |