summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1996-10-31 07:36:09 +0000
committerache <ache@FreeBSD.org>1996-10-31 07:36:09 +0000
commit71018396d18d81687c813c5a5d83309a78908bb8 (patch)
treea39c79b95738645d6fc4790836f0f0fccb250685 /gnu
parent357edcf415de49cb5c2517029b172e58d1c3cfc3 (diff)
downloadFreeBSD-src-71018396d18d81687c813c5a5d83309a78908bb8.zip
FreeBSD-src-71018396d18d81687c813c5a5d83309a78908bb8.tar.gz
Replace collate_range_cmp call by its code (GNU version)
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/sort/sort.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gnu/usr.bin/sort/sort.c b/gnu/usr.bin/sort/sort.c
index f4d6127..bb391a0 100644
--- a/gnu/usr.bin/sort/sort.c
+++ b/gnu/usr.bin/sort/sort.c
@@ -200,6 +200,22 @@ static int collates[UCHAR_LIM];
#define COLLDIFF(A, B) (collates[UCHAR (A)] - collates[UCHAR (B)])
+/* static */ int
+collate_range_cmp (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)
{
OpenPOWER on IntegriCloud