aboutsummaryrefslogtreecommitdiff
path: root/gnu/usr.bin/sort/sort.c
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1999-02-13 15:45:30 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1999-02-13 15:45:30 +0000
commitacd904fcc3a56e93ec4ec251df2f5d1917a55183 (patch)
tree2c8f1c20e8cd914394675734722e6d0088e7ee43 /gnu/usr.bin/sort/sort.c
parent88a603f7a971d6fccaa604fa6e4d0d422c13f4e7 (diff)
Notes
Diffstat (limited to 'gnu/usr.bin/sort/sort.c')
-rw-r--r--gnu/usr.bin/sort/sort.c39
1 files changed, 2 insertions, 37 deletions
diff --git a/gnu/usr.bin/sort/sort.c b/gnu/usr.bin/sort/sort.c
index 676215472d7d..8e17ac6df0ac 100644
--- a/gnu/usr.bin/sort/sort.c
+++ b/gnu/usr.bin/sort/sort.c
@@ -196,49 +196,17 @@ static int have_read_stdin;
static struct keyfield keyhead;
#ifdef __FreeBSD__
-static int collates[UCHAR_LIM];
-
-#define COLLDIFF(A, B) (collates[UCHAR (A)] - collates[UCHAR (B)])
-
static int
-collate_range_cmp (a, b)
+COLLDIFF (a, b)
int a, b;
{
- int r;
static char s[2][2];
if ((unsigned char)a == (unsigned char)b)
return 0;
s[0][0] = a;
s[1][0] = b;
- if ((r = strcoll(s[0], s[1])) == 0)
- r = (unsigned char)a - (unsigned char)b;
- return r;
-}
-
-static int
-collcompare (const void *sa, const void *sb)
-{
- return collate_range_cmp (*((int *)sa), *((int *)sb));
-}
-
-static void
-init_collates(void)
-{
- register int i, j;
- int reverse[UCHAR_LIM];
-
- for (i = 0; i < UCHAR_LIM; i++)
- reverse[i] = i;
- qsort(reverse, UCHAR_LIM, sizeof(reverse[0]), collcompare);
- for (i = 0; i < UCHAR_LIM; i++) {
- for (j = 0; j < UCHAR_LIM; j++) {
- if (reverse[j] == i) {
- collates[i] = j;
- break;
- }
- }
- }
+ return strcoll(s[0], s[1]);
}
#endif /* __FreeBSD__ */
@@ -501,9 +469,6 @@ inittables (void)
else
fold_toupper[i] = i;
}
-#ifdef __FreeBSD__
- init_collates();
-#endif
}
/* Initialize BUF, allocating ALLOC bytes initially. */