diff options
| author | nijtmans@users.sourceforge.net <jan.nijtmans> | 2013-05-21 09:38:05 (GMT) |
|---|---|---|
| committer | nijtmans@users.sourceforge.net <jan.nijtmans> | 2013-05-21 09:38:05 (GMT) |
| commit | 57f4241d3f7a1d744249666d3e4ce99845017ebb (patch) | |
| tree | 9dc61a4a45919373736ecb538eb905a029c8acfd | |
| parent | 0c7a16a7d9feaf0e55e6239e46e8592665496781 (diff) | |
| download | tcl-57f4241d3f7a1d744249666d3e4ce99845017ebb.zip tcl-57f4241d3f7a1d744249666d3e4ce99845017ebb.tar.gz tcl-57f4241d3f7a1d744249666d3e4ce99845017ebb.tar.bz2 | |
Slight improvement: if cs = "\xC0\x80" and ct = "\x00", loop would continue after NUL-byte, this should not happen.
| -rw-r--r-- | generic/tclUtf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 9dacb53..a7a2091 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -1110,12 +1110,12 @@ TclUtfCasecmp( CONST char *ct) /* UTF string cs is compared to. */ { Tcl_UniChar ch1, ch2; - char c; + int goOn; do { - /* If c == '\0', loop should end. */ - c = *cs; + /* If *cs == '\0' or *ct == '\0', loop should end. */ + goOn = *cs && *ct; cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); @@ -1124,7 +1124,7 @@ TclUtfCasecmp( ch2 = Tcl_UniCharToLower(ch2); if (ch1 != ch2) break; } - } while (c); + } while (goOn); return (ch1 - ch2); } |
