X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=opt%2Fmincoll%2Fwcscoll.c;fp=opt%2Fmincoll%2Fwcscoll.c;h=acdf6406ece0ea6671fe9fd264f69d3ea51c87f5;hp=0000000000000000000000000000000000000000;hb=14b5b78e19a79f590233caee7848e7cb19084088;hpb=41777e3d5dc655f59a8c3bcd071639e6878e853a diff --git a/opt/mincoll/wcscoll.c b/opt/mincoll/wcscoll.c new file mode 100644 index 0000000..acdf640 --- /dev/null +++ b/opt/mincoll/wcscoll.c @@ -0,0 +1,36 @@ +/* wcscoll( const wchar_t *, const wchar_t * ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#include + +#ifndef REGTEST + +/* I did much searching as to how various people implement this. + * + * OpenBSD, NetBSD and Musl libc for Linux implement this as a call to wcscmp + * and have various "todo" notices on this function, and on the other hand + * glibc implements it as a 500 line function. FreeBSD has an implementation + * which kind of uses their single byte character strcoll data for the first + * 256 characters, but looks incredibly fragile and likely to break. + * + * TL;DR: Nobody uses this, and this will probably work perfectly fine for you. + */ + +int wcscoll( const wchar_t * s1, const wchar_t * s2 ) +{ + return wcscmp(s1, s2); +} + +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +int main( void ) +{ + return TEST_RESULTS; +} +#endif