diff options
author | sebres <sebres@users.sourceforge.net> | 2018-03-14 17:17:44 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2018-03-14 17:17:44 (GMT) |
commit | 6e7c474da78d60f2d601b3ce3e2e269fd086c9d4 (patch) | |
tree | e643a61c0c15cea18fe5dab797d8b8a72eaf457a /generic | |
parent | fd2d896c8f9f8e330c209b7a2627cb53f9ff533e (diff) | |
download | tcl-6e7c474da78d60f2d601b3ce3e2e269fd086c9d4.zip tcl-6e7c474da78d60f2d601b3ce3e2e269fd086c9d4.tar.gz tcl-6e7c474da78d60f2d601b3ce3e2e269fd086c9d4.tar.bz2 |
TclTrim: special case for TrimRight on single char result of TrimLeft (this char is already verified within TrimLeft, so bypass TrimRight at all)
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclUtil.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c index a8791c5..fb5b21c 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1738,9 +1738,9 @@ TclTrim( int trimLeft; Tcl_DString bytesBuf, trimBuf; + *trimRight = 0; /* Empty strings -> nothing to do */ if ((numBytes == 0) || (numTrim == 0)) { - *trimRight = 0; return 0; } @@ -1754,8 +1754,8 @@ TclTrim( trimLeft = numBytes; } numBytes -= trimLeft; - *trimRight = 0; - if (numBytes) { + /* have to trim yet (first char was already verified within TrimLeft) */ + if (numBytes > 1) { bytes += trimLeft; *trimRight = TrimRight(bytes, numBytes, trim, numTrim); if (*trimRight > numBytes) { |