From: Tom Lane Date: Thu, 19 Oct 2006 20:56:22 +0000 (+0000) Subject: Rename our substitute qsort to pg_qsort at the link-symbol level (but X-Git-Tag: REL8_2_BETA2~27 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4887f5f979f36a5d389e898edca61bd6aa4f0f20;p=postgresql Rename our substitute qsort to pg_qsort at the link-symbol level (but provide a macro so code can still just say qsort). Avoids linker warnings on pickier platforms such as Darwin, and outright failure on MSVC. --- diff --git a/src/include/port.h b/src/include/port.h index c320418476..21c8b92643 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/port.h,v 1.104 2006/10/04 00:30:06 momjian Exp $ + * $PostgreSQL: pgsql/src/include/port.h,v 1.105 2006/10/19 20:56:22 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -363,6 +363,11 @@ extern int pqGethostbyname(const char *name, struct hostent ** result, int *herrno); +extern void pg_qsort(void *base, size_t nel, size_t elsize, + int (*cmp) (const void *, const void *)); + +#define qsort(a,b,c,d) pg_qsort(a,b,c,d) + typedef int (*qsort_arg_comparator) (const void *a, const void *b, void *arg); extern void qsort_arg(void *base, size_t nel, size_t elsize, diff --git a/src/port/qsort.c b/src/port/qsort.c index 8496f0a1d6..c0a6b194a0 100644 --- a/src/port/qsort.c +++ b/src/port/qsort.c @@ -9,7 +9,7 @@ * * CAUTION: if you change this file, see also qsort_arg.c * - * $PostgreSQL: pgsql/src/port/qsort.c,v 1.11 2006/10/12 15:04:55 tgl Exp $ + * $PostgreSQL: pgsql/src/port/qsort.c,v 1.12 2006/10/19 20:56:22 tgl Exp $ */ /* $NetBSD: qsort.c,v 1.13 2003/08/07 16:43:42 agc Exp $ */ @@ -46,8 +46,8 @@ #include "c.h" -static char *med3(char *, char *, char *, - int (*) (const void *, const void *)); +static char *med3(char *a, char *b, char *c, + int (*cmp) (const void *, const void *)); static void swapfunc(char *, char *, size_t, int); /* @@ -96,11 +96,7 @@ int swaptype; #define vecswap(a, b, n) if ((n) > 0) swapfunc((a), (b), (size_t)(n), swaptype) static char * -med3(a, b, c, cmp) -char *a, - *b, - *c; -int (*cmp) (const void *, const void *); +med3(char *a, char *b, char *c, int (*cmp) (const void *, const void *)) { return cmp(a, b) < 0 ? (cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a)) @@ -108,11 +104,7 @@ int (*cmp) (const void *, const void *); } void -qsort(a, n, es, cmp) -void *a; -size_t n, - es; -int (*cmp) (const void *, const void *); +pg_qsort(void *a, size_t n, size_t es, int (*cmp) (const void *, const void *)) { char *pa, *pb,