]> pd.if.org Git - pdclib/blob - opt/mincoll/wcscoll.c
dos2unix
[pdclib] / opt / mincoll / wcscoll.c
1 /* wcscoll( const wchar_t *, const wchar_t * )
2
3    This file is part of the Public Domain C Library (PDCLib).
4    Permission is granted to use, modify, and / or redistribute at will.
5 */
6
7 #include <wchar.h>
8
9 #ifndef REGTEST
10
11 /* I did much searching as to how various people implement this.
12  *
13  * OpenBSD, NetBSD and Musl libc for Linux implement this as a call to wcscmp
14  * and have various "todo" notices on this function, and on the other hand
15  * glibc implements it as a 500 line function. FreeBSD has an implementation 
16  * which kind of uses their single byte character strcoll data for the first
17  * 256 characters, but looks incredibly fragile and likely to break.
18  *
19  * TL;DR: Nobody uses this, and this will probably work perfectly fine for you.
20  */
21
22 int wcscoll( const wchar_t * s1, const wchar_t * s2 )
23 {
24     return wcscmp(s1, s2);
25 }
26
27 #endif
28
29 #ifdef TEST
30 #include "_PDCLIB_test.h"
31
32 int main( void )
33 {
34     return TEST_RESULTS;
35 }
36 #endif