]> git.ipfire.org Git - thirdparty/coreutils.git/commit
uniq: avoid strcoll() to improve performance and consistency
authorPádraig Brady <P@draigBrady.com>
Sun, 23 Feb 2020 13:20:08 +0000 (13:20 +0000)
committerPádraig Brady <P@draigBrady.com>
Mon, 24 Feb 2020 10:12:42 +0000 (10:12 +0000)
commit8e81d44b528b0abf6b9f02a70baf47aee52e2930
tree4a44b2f6f13051127e73d37fe1ce0c11cfd02dc6
parent61c49d369369773b45beeac659fa32b6f481e8be
uniq: avoid strcoll() to improve performance and consistency

strcoll() is only significant to uniq(1) if it returns 0,
and it generally only does so with buggy locales or mismatched
locales and data.  Some systems may have strcoll()
return 0 for equivalent normalized unicode forms,
but for consistency across platforms strcoll() is avoided.
The various cases are defined in the new test.
This is consistent with newer POSIX standards as discussed at:
https://www.austingroupbugs.net/view.php?id=963

* src/uniq.c: s/xstrcoll/memcmp/.
* tests/local.mk: Reference the new test.
* tests/misc/uniq-collate.sh: Add a new test.
* NEWS: Mention the change in behavior.
Fixes https://bugs.gnu.org/38627
NEWS
src/uniq.c
tests/local.mk
tests/misc/uniq-collate.sh [new file with mode: 0755]