Loading...
--- Libc/Libc-320/stdlib/FreeBSD/merge.c
+++ Libc/Libc-1583.40.7/stdlib/FreeBSD/merge.c
@@ -13,10 +13,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -34,11 +30,14 @@
* SUCH DAMAGE.
*/
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wcomma"
+
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94";
#endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/merge.c,v 1.6 2002/03/21 22:48:42 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/merge.c,v 1.8 2007/01/09 00:28:10 imp Exp $");
/*
* Hybrid exponential search/linear search merge sort with hybrid
@@ -60,8 +59,10 @@
#include <stdlib.h>
#include <string.h>
-static void setup(u_char *, u_char *, size_t, size_t, int (*)());
-static void insertionsort(u_char *, size_t, size_t, int (*)());
+static void setup(u_char *, u_char *, size_t, size_t,
+ int (*)(const void *, const void *));
+static void insertionsort(u_char *, size_t, size_t,
+ int (*)(const void *, const void *));
#define ISIZE sizeof(int)
#define PSIZE sizeof(u_char *)
@@ -97,13 +98,11 @@
* Arguments are as for qsort.
*/
int
-mergesort(base, nmemb, size, cmp)
- void *base;
- size_t nmemb;
- size_t size;
- int (*cmp)(const void *, const void *);
+mergesort(void *base, size_t nmemb, size_t size,
+ int (*cmp)(const void *, const void *))
{
- int i, sense;
+ size_t i;
+ int sense;
int big, iflag;
u_char *f1, *f2, *t, *b, *tp2, *q, *l1, *l2;
u_char *list2, *list1, *p2, *p, *last, **p1;
@@ -260,12 +259,11 @@
* is defined. Otherwise simple pairwise merging is used.)
*/
void
-setup(list1, list2, n, size, cmp)
- size_t n, size;
- int (*cmp)(const void *, const void *);
- u_char *list1, *list2;
+setup(u_char *list1, u_char *list2, size_t n, size_t size,
+ int (*cmp)(const void *, const void *))
{
- int i, length, size2, tmp, sense;
+ size_t i, size2;
+ int length, tmp, sense;
u_char *f1, *f2, *s, *l2, *last, *p2;
size2 = size*2;
@@ -334,10 +332,8 @@
* last 4 elements.
*/
static void
-insertionsort(a, n, size, cmp)
- u_char *a;
- size_t n, size;
- int (*cmp)(const void *, const void *);
+insertionsort(u_char *a, size_t n, size_t size,
+ int (*cmp)(const void *, const void *))
{
u_char *ai, *s, *t, *u, tmp;
int i;
@@ -350,3 +346,4 @@
swap(u, t);
}
}
+#pragma clang diagnostic pop