X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/144d479b7cd6f503d97f9d9ef3115839a0fa53c3..7d288d654793e867020b73d101c17d25bfbc256c:/pqsort.c diff --git a/pqsort.c b/pqsort.c index 8e2b1248..25775637 100644 --- a/pqsort.c +++ b/pqsort.c @@ -1,7 +1,7 @@ /* 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. */ @@ -37,26 +37,15 @@ * SUCH DAMAGE. */ -#define __P(protos) protos - -#include -#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 #include #include #include -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 @@ -99,7 +88,7 @@ swapfunc(char *a, char *b, size_t n, int swaptype) 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 ? @@ -109,7 +98,7 @@ med3(char *a, char *b, char *c, 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; @@ -201,7 +190,7 @@ loop: SWAPINIT(a, es); 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);