Skip to content

Commit 9e3755e

Browse files
committed
Remove useless duplicate inclusions of system header files.
c.h #includes a number of core libc header files, such as <stdio.h>. There's no point in re-including these after having read postgres.h, postgres_fe.h, or c.h; so remove code that did so. While at it, also fix some places that were ignoring our standard pattern of "include postgres[_fe].h, then system header files, then other Postgres header files". While there's not any great magic in doing it that way rather than system headers last, it's silly to have just a few files deviating from the general pattern. (But I didn't attempt to enforce this globally, only in files I was touching anyway.) I'd be the first to say that this is mostly compulsive neatnik-ism, but over time it might save enough compile cycles to be useful.
1 parent 5639ced commit 9e3755e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+41
-155
lines changed

contrib/fuzzystrmatch/dmetaphone.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ The remaining code is authored by Andrew Dunstan <amdunstan@ncshp.org> and
9393
***********************************************************************/
9494

9595

96-
97-
98-
9996
/* include these first, according to the docs */
10097
#ifndef DMETAPHONE_MAIN
10198

@@ -105,14 +102,19 @@ The remaining code is authored by Andrew Dunstan <amdunstan@ncshp.org> and
105102

106103
/* turn off assertions for embedded function */
107104
#define NDEBUG
108-
#endif
109105

106+
#else /* DMETAPHONE_MAIN */
107+
108+
/* we need these if we didn't get them from postgres.h */
110109
#include <stdio.h>
111-
#include <ctype.h>
112110
#include <stdlib.h>
113111
#include <string.h>
114112
#include <stdarg.h>
113+
114+
#endif /* DMETAPHONE_MAIN */
115+
115116
#include <assert.h>
117+
#include <ctype.h>
116118

117119
/* prototype for the main function we got from the perl module */
118120
static void DoubleMetaphone(char *, char **);

contrib/ltree/crc32.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99

1010
#include "postgres.h"
1111

12-
#include <sys/types.h>
13-
#include <stdio.h>
14-
#include <sys/types.h>
15-
1612
#ifdef LOWER_NODE
1713
#include <ctype.h>
1814
#define TOLOWER(x) tolower((unsigned char) (x))

contrib/pgcrypto/px.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#ifndef __PX_H
3333
#define __PX_H
3434

35-
#include <sys/types.h>
3635
#include <sys/param.h>
3736

3837
/* keep debug messages? */

src/backend/access/transam/timeline.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "postgres.h"
3333

3434
#include <sys/stat.h>
35-
#include <stdio.h>
3635
#include <unistd.h>
3736

3837
#include "access/timeline.h"

src/backend/access/transam/twophase.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454

5555
#include <fcntl.h>
5656
#include <sys/stat.h>
57-
#include <sys/types.h>
5857
#include <time.h>
5958
#include <unistd.h>
6059

src/backend/access/transam/xlogarchive.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include "postgres.h"
1616

17-
#include <sys/types.h>
1817
#include <sys/stat.h>
1918
#include <sys/wait.h>
2019
#include <signal.h>

src/backend/commands/dbcommands.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "postgres.h"
2121

2222
#include <fcntl.h>
23-
#include <locale.h>
2423
#include <unistd.h>
2524
#include <sys/stat.h>
2625

src/backend/commands/tablespace.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848

4949
#include <unistd.h>
5050
#include <dirent.h>
51-
#include <sys/types.h>
5251
#include <sys/stat.h>
5352

5453
#include "access/heapam.h"

src/backend/libpq/ifaddr.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "postgres.h"
2121

2222
#include <unistd.h>
23-
#include <sys/types.h>
2423
#include <sys/stat.h>
2524
#include <sys/socket.h>
2625
#include <netdb.h>

src/backend/port/atomics.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#ifdef WIN32
2222
#error "barriers are required (and provided) on WIN32 platforms"
2323
#endif
24-
#include <sys/types.h>
2524
#include <signal.h>
2625
#endif
2726

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy