Overview
| Artifact ID: | 37cb9ff0b094f7e651dcd42829f33c893acbddd7 |
|---|---|
| Ticket: | 3613609fffffffffffffffffffffffffffffffff
lsort -nocase does not sort non-ASCII correctly |
| User & Date: | apnadkarni on 2013-05-21 09:59:01 |
Changes
- icomment:
I wrote a replacement stub along the lines of char *a, *b; int alen, blen, len; int comparison; a = Tcl_GetStringFromObj(oaP, &alen); b = Tcl_GetStringFromObj(obP, &blen); /* TBD - maybe check first letter before calling ? */ // This is much slower than the strcmp method alen = Tcl_NumUtfChars(a, alen); /* Num bytes -> num chars */ blen = Tcl_NumUtfChars(b, blen); /* Num bytes -> num chars */ len = alen < blen ? alen : blen; /* len is the shorter length */ comparison = (ignorecase ? Tcl_UtfNcasecmp : Tcl_UtfNcmp)(a, b, len); if (comparison == 0) { comparison = alen-blen; } return (comparison > 0) ? 1 : ((comparison < 0) ? -1 : 0); This seems to work correctly (for the single test case!). However, by my measurements, it is almost "3 times slower" than the current strcmp based code. I don't know if that can be fixed. And if it has not bothered anyone else for so many years, well... Failure in the lsearch case is quite likely more important (comparing paths on Windows for instance). string compare seems to do the right thing /Ashok - login: "apnadkarni"
- mimetype: "text/plain"
- username: "apnadkarni"