diff options
author | ache <ache@FreeBSD.org> | 1999-02-13 15:45:30 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1999-02-13 15:45:30 +0000 |
commit | d6fcbb03bca3399e98f8f7b95cd12229b7d228bb (patch) | |
tree | fb8b09afe811c570be849b88f3b27801856f4ce9 /gnu/usr.bin/sort | |
parent | 8359a77c52ee946f3759918c8523105840fc11f9 (diff) | |
download | FreeBSD-src-d6fcbb03bca3399e98f8f7b95cd12229b7d228bb.zip FreeBSD-src-d6fcbb03bca3399e98f8f7b95cd12229b7d228bb.tar.gz |
remove collating optimization - not work with substituted characters
Diffstat (limited to 'gnu/usr.bin/sort')
-rw-r--r-- | gnu/usr.bin/sort/sort.c | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/gnu/usr.bin/sort/sort.c b/gnu/usr.bin/sort/sort.c index 6762154..8e17ac6 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. */ |