/* The following is the NetBSD libc qsort implementation modified in order to
* support partial sorting of ranges for Redis.
*
- * Copyright(C) 2009 Salvatore Sanfilippo. All rights reserved.
+ * Copyright(C) 2009-2010 Salvatore Sanfilippo. All rights reserved.
*
* The original copyright notice follows. */
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)qsort.c 8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: qsort.c,v 1.19 2009/01/30 23:38:44 lukem Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
#include <sys/types.h>
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
-static inline char *med3 __P((char *, char *, char *,
- int (*)(const void *, const void *)));
-static inline void swapfunc __P((char *, char *, size_t, int));
+static inline char *med3 (char *, char *, char *,
+ int (*)(const void *, const void *));
+static inline void swapfunc (char *, char *, size_t, int);
#define min(a, b) (a) < (b) ? a : b
static inline char *
med3(char *a, char *b, char *c,
- int (*cmp) __P((const void *, const void *)))
+ int (*cmp) (const void *, const void *))
{
return cmp(a, b) < 0 ?
static void
_pqsort(void *a, size_t n, size_t es,
- int (*cmp) __P((const void *, const void *)), void *lrange, void *rrange)
+ int (*cmp) (const void *, const void *), void *lrange, void *rrange)
{
char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
size_t d, r;
void
pqsort(void *a, size_t n, size_t es,
- int (*cmp) __P((const void *, const void *)), size_t lrange, size_t rrange)
+ int (*cmp) (const void *, const void *), size_t lrange, size_t rrange)
{
_pqsort(a,n,es,cmp,((unsigned char*)a)+(lrange*es),
((unsigned char*)a)+((rrange+1)*es)-1);