From 58c9a4b908c79c0b6183951e7dd68dc69cbf4415 Mon Sep 17 00:00:00 2001 From: Kiyoshi Aman Date: Wed, 5 Jun 2019 06:21:58 -0500 Subject: usr.bin/sort: make buildable with libbsd --- usr.bin/sort/radix_sort.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'usr.bin/sort/radix_sort.c') diff --git a/usr.bin/sort/radix_sort.c b/usr.bin/sort/radix_sort.c index 4ec5ff8..588fca4 100644 --- a/usr.bin/sort/radix_sort.c +++ b/usr.bin/sort/radix_sort.c @@ -32,15 +32,6 @@ * SUCH DAMAGE. */ -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)radixsort.c 8.2 (Berkeley) 4/28/95"; -#else -__RCSID("$NetBSD: radix_sort.c,v 1.4 2009/09/19 16:18:00 dsl Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - /* * 'stable' radix sort initially from libc/stdlib/radixsort.c */ @@ -49,7 +40,6 @@ __RCSID("$NetBSD: radix_sort.c,v 1.4 2009/09/19 16:18:00 dsl Exp $"); #include #include -#include #include "sort.h" typedef struct { @@ -70,14 +60,14 @@ static void simplesort(RECHEADER **, int, int); void radix_sort(RECHEADER **a, RECHEADER **ta, int n) { - u_int count[256], nc, bmin; - u_int c; + unsigned int count[256], nc, bmin; + unsigned int c; RECHEADER **ak, **tai, **lim; RECHEADER *hdr; int stack_size = 512; stack *s, *sp, *sp0, *sp1, temp; RECHEADER **top[256]; - u_int *cp, bigc; + unsigned int *cp, bigc; int data_index = 0; if (n < THRESHOLD && !DEBUG('r')) { @@ -85,7 +75,7 @@ radix_sort(RECHEADER **a, RECHEADER **ta, int n) return; } - s = emalloc(stack_size * sizeof *s); + s = malloc(stack_size * sizeof *s); memset(&count, 0, sizeof count); /* Technically 'top' doesn't need zeroing */ memset(&top, 0, sizeof top); @@ -129,7 +119,7 @@ radix_sort(RECHEADER **a, RECHEADER **ta, int n) */ if (sp + nc > s + stack_size) { stack_size *= 2; - sp1 = erealloc(s, stack_size * sizeof *s); + sp1 = realloc(s, stack_size * sizeof *s); sp = sp1 + (sp - s); s = sp1; } @@ -170,7 +160,7 @@ simplesort(RECHEADER **a, int n, int data_index) RECHEADER **ak, **ai; RECHEADER *akh; RECHEADER **lim = a + n; - const u_char *s, *t; + const unsigned char *s, *t; int s_len, t_len; int i; int r; -- cgit v1.2.3-60-g2f50