Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4887f5f

Browse files
committed
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 warningson pickier platforms such as Darwin, and outright failure on MSVC.
1 parent443abd8 commit4887f5f

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

‎src/include/port.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/port.h,v 1.104 2006/10/04 00:30:06 momjian Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.105 2006/10/19 20:56:22 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -363,6 +363,11 @@ extern int pqGethostbyname(const char *name,
363363
structhostent**result,
364364
int*herrno);
365365

366+
externvoidpg_qsort(void*base,size_tnel,size_telsize,
367+
int (*cmp) (constvoid*,constvoid*));
368+
369+
#defineqsort(a,b,c,d) pg_qsort(a,b,c,d)
370+
366371
typedefint (*qsort_arg_comparator) (constvoid*a,constvoid*b,void*arg);
367372

368373
externvoidqsort_arg(void*base,size_tnel,size_telsize,

‎src/port/qsort.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*CAUTION: if you change this file, see also qsort_arg.c
1111
*
12-
*$PostgreSQL: pgsql/src/port/qsort.c,v 1.11 2006/10/12 15:04:55 tgl Exp $
12+
*$PostgreSQL: pgsql/src/port/qsort.c,v 1.12 2006/10/19 20:56:22 tgl Exp $
1313
*/
1414

1515
/*$NetBSD: qsort.c,v 1.13 2003/08/07 16:43:42 agc Exp $*/
@@ -46,8 +46,8 @@
4646
#include"c.h"
4747

4848

49-
staticchar*med3(char*,char*,char*,
50-
int (*) (constvoid*,constvoid*));
49+
staticchar*med3(char*a,char*b,char*c,
50+
int (*cmp) (constvoid*,constvoid*));
5151
staticvoidswapfunc(char*,char*,size_t,int);
5252

5353
/*
@@ -96,23 +96,15 @@ intswaptype;
9696
#definevecswap(a,b,n) if ((n) > 0) swapfunc((a), (b), (size_t)(n), swaptype)
9797

9898
staticchar*
99-
med3(a,b,c,cmp)
100-
char*a,
101-
*b,
102-
*c;
103-
int(*cmp) (constvoid*,constvoid*);
99+
med3(char*a,char*b,char*c,int (*cmp) (constvoid*,constvoid*))
104100
{
105101
returncmp(a,b)<0 ?
106102
(cmp(b,c)<0 ?b : (cmp(a,c)<0 ?c :a))
107103
: (cmp(b,c)>0 ?b : (cmp(a,c)<0 ?a :c));
108104
}
109105

110106
void
111-
qsort(a,n,es,cmp)
112-
void*a;
113-
size_tn,
114-
es;
115-
int(*cmp) (constvoid*,constvoid*);
107+
pg_qsort(void*a,size_tn,size_tes,int (*cmp) (constvoid*,constvoid*))
116108
{
117109
char*pa,
118110
*pb,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp