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

Commit06e1d62

Browse files
committed
Fix a whole bunch of #includes that were either wrong or redundant.
The first rule of portability for us is 'thou shalt have no other godsbefore c.h', and a whole lot of these files were either not includingc.h at all, or including random system headers beforehand, either ofwhich sins can mess up largefile support nicely. Once you haveincluded c.h, there is no need to re-include what it includes, either.
1 parent420cfd0 commit06e1d62

19 files changed

+44
-57
lines changed

‎src/port/crypt.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ __RCSID("$NetBSD: crypt.c,v 1.18 2001/03/01 14:37:35 wiz Exp $");
4343

4444
#include"c.h"
4545

46-
#include<stddef.h>
47-
#include<sys/types.h>
4846
#include<limits.h>
49-
#include<stdlib.h>
5047

5148
#ifndefWIN32
5249
#include<unistd.h>

‎src/port/fseeko.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/fseeko.c,v 1.17 2004/12/31 22:03:53 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/port/fseeko.c,v 1.18 2005/07/28 04:03:14 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -24,10 +24,8 @@
2424
#ifdefbsdi
2525
#include<pthread.h>
2626
#endif
27-
#include<stdio.h>
28-
#include<sys/types.h>
2927
#include<sys/stat.h>
30-
#include<errno.h>
28+
3129

3230
/*
3331
*On BSD/OS and NetBSD, off_t and fpos_t are the same. Standards

‎src/port/getaddrinfo.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Copyright (c) 2003-2005, PostgreSQL Global Development Group
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/port/getaddrinfo.c,v 1.16 2005/01/01 20:44:33 tgl Exp $
15+
* $PostgreSQL: pgsql/src/port/getaddrinfo.c,v 1.17 2005/07/28 04:03:14 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -21,7 +21,6 @@
2121
#include"c.h"
2222

2323
#ifndefWIN32_CLIENT_ONLY
24-
#include<sys/types.h>
2524
#include<sys/socket.h>
2625
#include<netdb.h>
2726
#include<netinet/in.h>

‎src/port/gethostname.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/port/gethostname.c,v 1.6 2004/12/31 22:03:53 pgsql Exp $
10+
* $PostgreSQL: pgsql/src/port/gethostname.c,v 1.7 2005/07/28 04:03:14 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
1414

1515
#include"c.h"
1616

17-
#include<string.h>
18-
1917
#include<sys/utsname.h>
2018

2119
int

‎src/port/getopt.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,10 @@
3434

3535
#include"c.h"
3636

37-
3837
#if defined(LIBC_SCCS)&& !defined(lint)
3938
staticcharsccsid[]="@(#)getopt.c8.3 (Berkeley) 4/27/95";
4039
#endif/* LIBC_SCCS and not lint */
4140

42-
#include<stdio.h>
43-
#include<stdlib.h>
44-
#include<string.h>
4541

4642
intopterr=1,/* if error message should be printed */
4743
optind=1,/* index into parent argv vector */

‎src/port/getopt_long.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,22 @@
3535
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3636
* SUCH DAMAGE.
3737
*
38-
* $PostgreSQL: pgsql/src/port/getopt_long.c,v 1.3 2003/11/29 19:52:13 pgsql Exp $
38+
* $PostgreSQL: pgsql/src/port/getopt_long.c,v 1.4 2005/07/28 04:03:14 tgl Exp $
3939
*/
4040

41-
#include<stdio.h>
42-
#include<stdlib.h>
43-
#include<string.h>
41+
#include"c.h"
4442

4543
#include"getopt_long.h"
4644

45+
#ifndefHAVE_INT_OPTRESET
46+
intoptreset;
47+
#endif
48+
4749
#defineBADCH'?'
4850
#defineBADARG':'
4951
#defineEMSG""
5052

53+
5154
int
5255
getopt_long(intargc,char*constargv[],
5356
constchar*optstring,

‎src/port/getrusage.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/getrusage.c,v 1.9 2005/05/16 05:52:13 neilc Exp $
11+
* $PostgreSQL: pgsql/src/port/getrusage.c,v 1.10 2005/07/28 04:03:14 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
1515

16-
#include<stdio.h>
17-
#include<errno.h>
18-
1916
#include"c.h"
17+
2018
#include"rusagestub.h"
2119

2220
/* This code works on:

‎src/port/memcmp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/port/memcmp.c,v 1.7 2004/12/31 22:03:53 pgsql Exp $
10+
* $PostgreSQL: pgsql/src/port/memcmp.c,v 1.8 2005/07/28 04:03:14 tgl Exp $
1111
*
1212
* This file was taken from NetBSD and is used by SunOS because memcmp
1313
* on that platform does not properly compare negative bytes. The
@@ -46,7 +46,8 @@
4646
* SUCH DAMAGE.
4747
*/
4848

49-
#include<string.h>
49+
#include"c.h"
50+
5051

5152
/*
5253
* Compare memory regions.

‎src/port/noblock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/port/noblock.c,v 1.6 2005/03/25 00:34:31 tgl Exp $
10+
* $PostgreSQL: pgsql/src/port/noblock.c,v 1.7 2005/07/28 04:03:14 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
1414

1515
#include"c.h"
1616

17-
#include<sys/types.h>
1817
#include<fcntl.h>
1918

19+
2020
bool
2121
pg_set_noblock(intsock)
2222
{

‎src/port/open.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
*
77
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
88
*
9-
* $PostgreSQL: pgsql/src/port/open.c,v 1.9 2005/03/24 04:36:20 momjian Exp $
9+
* $PostgreSQL: pgsql/src/port/open.c,v 1.10 2005/07/28 04:03:14 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
1313

1414
#ifdefWIN32
1515

16-
#include<postgres.h>
16+
#include"c.h"
17+
1718
#include<windows.h>
1819
#include<fcntl.h>
19-
#include<errno.h>
2020
#include<assert.h>
2121

2222
intwin32_open(constchar*fileName,intfileFlags, ...);

‎src/port/qsort.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Add do ... while() macro fix
44
* Remove __inline, _DIAGASSERTs, __P
55
*
6-
*$PostgreSQL: pgsql/src/port/qsort.c,v 1.6 2005/05/25 21:40:43 momjian Exp $
6+
*$PostgreSQL: pgsql/src/port/qsort.c,v 1.7 2005/07/28 04:03:14 tgl Exp $
77
*/
88

99
/*$NetBSD: qsort.c,v 1.13 2003/08/07 16:43:42 agc Exp $*/
@@ -37,9 +37,7 @@
3737
* SUCH DAMAGE.
3838
*/
3939

40-
#include<stdlib.h>
41-
#include<errno.h>
42-
#include<sys/types.h>
40+
#include"c.h"
4341

4442

4543
staticchar*med3(char*,char*,char*,

‎src/port/random.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/random.c,v 1.5 2004/12/31 22:03:53 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/port/random.c,v 1.6 2005/07/28 04:03:14 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
1515

1616
#include"c.h"
1717

18-
#include<stdlib.h>
1918
#include<math.h>
20-
#include<errno.h>
19+
2120

2221
long
2322
random()

‎src/port/snprintf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* SUCH DAMAGE.
3333
*/
3434

35-
#include"postgres.h"
35+
#include"c.h"
3636

3737
#ifndefWIN32
3838
#include<sys/ioctl.h>
@@ -62,7 +62,7 @@
6262
* causing nasty effects.
6363
**************************************************************/
6464

65-
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.27 2005/04/14 20:53:09 tgl Exp $";*/
65+
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.28 2005/07/28 04:03:14 tgl Exp $";*/
6666

6767
staticvoiddopr(char*buffer,constchar*format,va_listargs,char*end);
6868

‎src/port/srandom.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/srandom.c,v 1.5 2004/12/31 22:03:53 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/port/srandom.c,v 1.6 2005/07/28 04:03:14 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
1515

1616
#include"c.h"
1717

18-
#include<stdlib.h>
1918
#include<math.h>
20-
#include<errno.h>
19+
2120

2221
void
2322
srandom(unsignedintseed)

‎src/port/strdup.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/strdup.c,v 1.6 2004/12/31 22:03:53 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/port/strdup.c,v 1.7 2005/07/28 04:03:14 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
1515

16-
#include<string.h>
17-
#include<stdlib.h>
16+
#include"c.h"
17+
1818
#include"strdup.h"
1919

20+
2021
char*
2122
strdup(charconst*string)
2223
{

‎src/port/strerror.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/port/strerror.c,v 1.4 2005/02/22 04:43:16 momjian Exp $ */
1+
/* $PostgreSQL: pgsql/src/port/strerror.c,v 1.5 2005/07/28 04:03:14 tgl Exp $ */
22

33
/*
44
* strerror - map error number to descriptive string
@@ -9,9 +9,8 @@
99
* modified for ANSI by D'Arcy J.M. Cain
1010
*/
1111

12-
#include<string.h>
13-
#include<stdio.h>
14-
#include<errno.h>
12+
#include"c.h"
13+
1514

1615
externconstchar*constsys_errlist[];
1716
externintsys_nerr;

‎src/port/strtol.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@
3636
staticcharsccsid[]="@(#)strtol.c5.4 (Berkeley) 2/23/91";
3737
#endif/* LIBC_SCCS and not lint */
3838

39+
#include"c.h"
40+
3941
#include<limits.h>
4042
#include<ctype.h>
41-
#include<errno.h>
42-
#include<stdlib.h>
43+
4344

4445
#defineconst
4546

‎src/port/strtoul.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@
3535
staticcharsccsid[]="@(#)strtoul.c8.1 (Berkeley) 6/4/93";
3636
#endif/* LIBC_SCCS and not lint */
3737

38+
#include"c.h"
39+
3840
#include<limits.h>
3941
#include<ctype.h>
40-
#include<errno.h>
41-
#include<stdlib.h>
42+
4243

4344
/*
4445
* Convert a string to an unsigned long integer.

‎src/port/thread.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77
*
88
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
99
*
10-
* $PostgreSQL: pgsql/src/port/thread.c,v 1.29 2004/12/31 22:03:53 pgsql Exp $
10+
* $PostgreSQL: pgsql/src/port/thread.c,v 1.30 2005/07/28 04:03:14 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
1414

1515
#include"c.h"
1616

17-
#include<sys/types.h>
18-
#include<errno.h>
1917
#ifdefWIN32_CLIENT_ONLY
2018
#undef ERROR
2119
#else
@@ -25,6 +23,7 @@
2523
#include<pthread.h>
2624
#endif
2725

26+
2827
/*
2928
*Threading sometimes requires specially-named versions of functions
3029
*that return data in static buffers, like strerror_r() instead of

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp