summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
authorrodrigc <rodrigc@FreeBSD.org>2015-09-14 18:44:13 +0000
committerrodrigc <rodrigc@FreeBSD.org>2015-09-14 18:44:13 +0000
commit03b17210edf9302037068143643c1e06386de92e (patch)
tree9233dab12e187d6c5c5baddafab2900cdbf513ee /lib/libc/stdlib
parent5ad1f2444d736f306932d8a69b8357c63297cc83 (diff)
downloadFreeBSD-src-03b17210edf9302037068143643c1e06386de92e.zip
FreeBSD-src-03b17210edf9302037068143643c1e06386de92e.tar.gz
Use ANSI C prototypes.
Eliminates gcc 4.9 warnings.
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r--lib/libc/stdlib/heapsort.c11
-rw-r--r--lib/libc/stdlib/merge.c18
-rw-r--r--lib/libc/stdlib/radixsort.c30
3 files changed, 14 insertions, 45 deletions
diff --git a/lib/libc/stdlib/heapsort.c b/lib/libc/stdlib/heapsort.c
index 673a6a1..16c1bfe 100644
--- a/lib/libc/stdlib/heapsort.c
+++ b/lib/libc/stdlib/heapsort.c
@@ -147,16 +147,11 @@ typedef DECLARE_BLOCK(int, heapsort_block, const void *, const void *);
*/
#ifdef I_AM_HEAPSORT_B
int
-heapsort_b(vbase, nmemb, size, compar)
- void *vbase;
- size_t nmemb, size;
- heapsort_block compar;
+heapsort_b(void *vbase, size_t nmemb, size_t size, heapsort_block compar)
#else
int
-heapsort(vbase, nmemb, size, compar)
- void *vbase;
- size_t nmemb, size;
- int (*compar)(const void *, const void *);
+heapsort(void *vbase, size_t nmemb, size_t size,
+ int (*compar)(const void *, const void *))
#endif
{
size_t cnt, i, j, l;
diff --git a/lib/libc/stdlib/merge.c b/lib/libc/stdlib/merge.c
index 6b368c3..17f07eb 100644
--- a/lib/libc/stdlib/merge.c
+++ b/lib/libc/stdlib/merge.c
@@ -104,14 +104,10 @@ static void insertionsort(u_char *, size_t, size_t, cmp_t);
*/
int
#ifdef I_AM_MERGESORT_B
-mergesort_b(base, nmemb, size, cmp)
+mergesort_b(void *base, size_t nmemb, size_t size, cmp_t cmp)
#else
-mergesort(base, nmemb, size, cmp)
+mergesort(void *base, size_t nmemb, size_t size, cmp_t cmp)
#endif
- void *base;
- size_t nmemb;
- size_t size;
- cmp_t cmp;
{
size_t i;
int sense;
@@ -271,10 +267,7 @@ COPY: b = t;
* is defined. Otherwise simple pairwise merging is used.)
*/
void
-setup(list1, list2, n, size, cmp)
- size_t n, size;
- u_char *list1, *list2;
- cmp_t cmp;
+setup(u_char *list1, u_char *list2, size_t n, size_t size, cmp_t cmp)
{
int i, length, size2, tmp, sense;
u_char *f1, *f2, *s, *l2, *last, *p2;
@@ -345,10 +338,7 @@ setup(list1, list2, n, size, cmp)
* last 4 elements.
*/
static void
-insertionsort(a, n, size, cmp)
- u_char *a;
- size_t n, size;
- cmp_t cmp;
+insertionsort(u_char *a, size_t n, size_t size, cmp_t cmp)
{
u_char *ai, *s, *t, *u, tmp;
int i;
diff --git a/lib/libc/stdlib/radixsort.c b/lib/libc/stdlib/radixsort.c
index 8310e6d..205f776 100644
--- a/lib/libc/stdlib/radixsort.c
+++ b/lib/libc/stdlib/radixsort.c
@@ -88,10 +88,7 @@ static void r_sort_b(const u_char **, const u_char **, int, int,
}
int
-radixsort(a, n, tab, endch)
- const u_char **a, *tab;
- int n;
- u_int endch;
+radixsort(const u_char **a, int n, const u_char *tab, u_int endch)
{
const u_char *tr;
int c;
@@ -103,10 +100,7 @@ radixsort(a, n, tab, endch)
}
int
-sradixsort(a, n, tab, endch)
- const u_char **a, *tab;
- int n;
- u_int endch;
+sradixsort(const u_char **a, int n, const u_char *tab, u_int endch)
{
const u_char *tr, **ta;
int c;
@@ -131,11 +125,7 @@ sradixsort(a, n, tab, endch)
/* Unstable, in-place sort. */
static void
-r_sort_a(a, n, i, tr, endch)
- const u_char **a;
- int n, i;
- const u_char *tr;
- u_int endch;
+r_sort_a(const u_char **a, int n, int i, const u_char *tr, u_int endch)
{
static int count[256], nc, bmin;
int c;
@@ -233,11 +223,8 @@ r_sort_a(a, n, i, tr, endch)
/* Stable sort, requiring additional memory. */
static void
-r_sort_b(a, ta, n, i, tr, endch)
- const u_char **a, **ta;
- int n, i;
- const u_char *tr;
- u_int endch;
+r_sort_b(const u_char **a, const u_char **ta, int n, int i, const u_char *tr,
+ u_int endch)
{
static int count[256], nc, bmin;
int c;
@@ -304,12 +291,9 @@ r_sort_b(a, ta, n, i, tr, endch)
}
}
+/* insertion sort */
static inline void
-simplesort(a, n, b, tr, endch) /* insertion sort */
- const u_char **a;
- int n, b;
- const u_char *tr;
- u_int endch;
+simplesort(const u_char **a, int n, int b, const u_char *tr, u_int endch)
{
u_char ch;
const u_char **ak, **ai, *s, *t;
OpenPOWER on IntegriCloud