diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-11-14 17:48:35 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-11-14 17:48:35 +0100 |
commit | eb659a82ded377db65c3878d7170b7be1542d926 (patch) | |
tree | a377c7a08a4cfa8912772ff0de6ec5675e77e24e /runtime/stringbuf.c | |
parent | 62ab1c20b3f40014efa9448bd45da4c333b225c2 (diff) | |
parent | c0f5dd3fbf877799ac8fec4d00b2f2c69014b413 (diff) | |
download | rsyslog-eb659a82ded377db65c3878d7170b7be1542d926.tar.gz rsyslog-eb659a82ded377db65c3878d7170b7be1542d926.tar.bz2 rsyslog-eb659a82ded377db65c3878d7170b7be1542d926.zip |
Merge branch 'v7-stable'
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 e7fd72c2..5bca009d 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 |