1 --- strcoll.c.bsdnew 2009-11-18 18:24:34.000000000 -0800
2 +++ strcoll.c 2009-11-18 18:26:43.000000000 -0800
5 __FBSDID("$FreeBSD: src/lib/libc/string/strcoll.c,v 1.14 2009/02/03 17:58:20 danger Exp $");
7 +#include "xlocale_private.h"
16 -strcoll(const char *s, const char *s2)
17 +strcoll_l(const char *s, const char *s2, locale_t loc)
19 - int len, len2, prim, prim2, sec, sec2, ret, ret2;
23 + const wchar_t *t = NULL, *t2 = NULL;
26 - if (__collate_load_error)
27 + NORMALIZE_LOCALE(loc);
28 + if (loc->__collate_load_error || (t = __collate_mbstowcs(s, loc)) == NULL || (t2 = __collate_mbstowcs(s2, loc)) == NULL) {
37 - if (__collate_substitute_nontrivial) {
38 - t = tt = __collate_substitute(s);
39 - t2 = tt2 = __collate_substitute(s2);
47 - while(*t && !prim) {
48 - __collate_lookup(t, &len, &prim, &sec);
51 - while(*t2 && !prim2) {
52 - __collate_lookup(t2, &len2, &prim2, &sec2);
65 - ret = -(int)((u_char)*t2);
68 - else if(!*t && !*t2)
74 + ret = wcscoll_l(t, t2, loc);
84 +strcoll(const char *s, const char *s2)
86 + return strcoll_l(s, s2, __current_locale());