summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2004-04-22 18:18:44 +0000
committerSimon Tatham <anakin@pobox.com>2004-04-22 18:18:44 +0000
commit7a70c3f76a57935569cefbc0f1ce86863fdef5b6 (patch)
treee3a8585d51ef3b22fe5706091349c10ebd826c37 /misc.c
parentfb251259853bfc795ea5db1a0e9393e1f5c4fbc1 (diff)
downloadhalibut-7a70c3f76a57935569cefbc0f1ce86863fdef5b6.zip
halibut-7a70c3f76a57935569cefbc0f1ce86863fdef5b6.tar.gz
halibut-7a70c3f76a57935569cefbc0f1ce86863fdef5b6.tar.bz2
halibut-7a70c3f76a57935569cefbc0f1ce86863fdef5b6.tar.xz
Use wcscoll(), if available, when sorting index terms. (In a
somewhat roundabout and arse-backwards sort of way, due to some other properties of the sort that I rather wanted to maintain. But I hope it should still do some good.) [originally from svn r4119]
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/misc.c b/misc.c
index 12333e7..aa05878 100644
--- a/misc.c
+++ b/misc.c
@@ -194,10 +194,25 @@ int compare_wordlists(word *a, word *b) {
}
}
+#ifdef HAS_WCSCOLL
+ {
+ wchar_t a[2], b[2];
+ int ret;
+
+ a[0] = pos[0].c;
+ b[0] = pos[1].c;
+ a[1] = b[1] = L'\0';
+
+ ret = wcscoll(a, b);
+ if (ret)
+ return ret;
+ }
+#else
if (pos[0].c < pos[1].c)
return -1;
else if (pos[0].c > pos[1].c)
return +1;
+#endif
if (!pos[0].c)
break; /* they're equal */