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.
***********************************************************************/
-
-
-
/* include these first, according to the docs */
#ifndef DMETAPHONE_MAIN
/* turn off assertions for embedded function */
#define NDEBUG
-#endif
+#else /* DMETAPHONE_MAIN */
+
+/* we need these if we didn't get them from postgres.h */
#include <stdio.h>
-#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
+
+#endif /* DMETAPHONE_MAIN */
+
#include <assert.h>
+#include <ctype.h>
/* prototype for the main function we got from the perl module */
static void DoubleMetaphone(char *, char **);
#include "postgres.h"
-#include <sys/types.h>
-#include <stdio.h>
-#include <sys/types.h>
-
#ifdef LOWER_NODE
#include <ctype.h>
#define TOLOWER(x) tolower((unsigned char) (x))
#ifndef __PX_H
#define __PX_H
-#include <sys/types.h>
#include <sys/param.h>
/* keep debug messages? */
#include "postgres.h"
#include <sys/stat.h>
-#include <stdio.h>
#include <unistd.h>
#include "access/timeline.h"
#include <fcntl.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include "postgres.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <signal.h>
#include "postgres.h"
#include <fcntl.h>
-#include <locale.h>
#include <unistd.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include "access/heapam.h"
#include "postgres.h"
#include <unistd.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netdb.h>
#ifdef WIN32
#error "barriers are required (and provided) on WIN32 platforms"
#endif
-#include <sys/types.h>
#include <signal.h>
#endif
#ifndef PORT_PROTOS_H
#define PORT_PROTOS_H
-#include <sys/types.h>
#include <nlist.h>
#include <link.h>
#include <dlfcn.h>
#ifndef PORT_PROTOS_H
#define PORT_PROTOS_H
-#include <sys/types.h>
#include <nlist.h>
#include <link.h>
#include <dlfcn.h>
#ifndef PORT_PROTOS_H
#define PORT_PROTOS_H
-#include <sys/types.h>
#include <nlist.h>
#include <link.h>
#include <dlfcn.h>
#include "postgres.h"
#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <string.h>
+
/*
* Some versions of the MS SDK contain "typedef enum { ... } ;" which the MS
* compiler quite sanely complains about. Well done, Microsoft.
#include "postgres.h"
#include <signal.h>
-#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
*/
#include "postgres.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
#include "postgres.h"
#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
#include "miscadmin.h"
*/
#include "postgres.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
#include "postgres.h"
#include <fcntl.h>
-#include <string.h>
#include <unistd.h>
#ifndef WIN32
#include <sys/mman.h>
#include "postgres.h"
#include <fcntl.h>
-#include <string.h>
#include <unistd.h>
#ifndef WIN32
#include <sys/mman.h>
#include <signal.h>
#include <unistd.h>
#include <sys/time.h>
-#include <sys/types.h>
#ifdef HAVE_SYS_EPOLL_H
#include <sys/epoll.h>
#endif
#include <limits.h>
#include <ctype.h>
#include <math.h>
-#include <locale.h>
#include "libpq/pqformat.h"
#include "utils/builtins.h"
#include "postgres.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include "access/heapam.h"
#include "postgres.h"
-#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "postgres.h"
-#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "postgres.h"
-#include <locale.h>
#include <time.h>
#include "access/htup_details.h"
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/time.h>
-#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <grp.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <locale.h>
#include <signal.h>
#include <time.h>
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <time.h>
#include <dirent.h>
#include <signal.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
#include "libpq-fe.h"
#include "postgres_fe.h"
-#include <stdio.h>
-#include <string.h>
#include <sys/time.h>
-#include <sys/types.h>
#include <unistd.h>
/* for ntohl/htonl */
#include "postgres_fe.h"
-#include "catalog/pg_control.h"
-#include "common/controldata_utils.h"
-#include "libpq-fe.h"
-#include "pqexpbuffer.h"
-
#include <fcntl.h>
-#include <locale.h>
#include <signal.h>
#include <time.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/resource.h>
#endif
+#include "catalog/pg_control.h"
+#include "common/controldata_utils.h"
#include "getopt_long.h"
+#include "libpq-fe.h"
#include "miscadmin.h"
+#include "pqexpbuffer.h"
/* PID can be negative for standalone backend */
typedef long pgpid_t;
#include "postgres_fe.h"
+#ifndef WIN32
+#include <sys/wait.h>
+#include <signal.h>
+#include <unistd.h>
+#include <fcntl.h>
+#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include "pg_backup_utils.h"
#include "fe_utils/string_utils.h"
-#ifndef WIN32
-#include <sys/types.h>
-#include <sys/wait.h>
-#include "signal.h"
-#include <unistd.h>
-#include <fcntl.h>
-#endif
-
/* Mnemonic macros for indexing the fd array returned by pipe(2) */
#define PIPE_READ 0
#define PIPE_WRITE 1
*/
#include "postgres_fe.h"
-#include "parallel.h"
-#include "pg_backup_archiver.h"
-#include "pg_backup_db.h"
-#include "pg_backup_utils.h"
-#include "dumputils.h"
-#include "fe_utils/string_utils.h"
-
#include <ctype.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <sys/wait.h>
-
#ifdef WIN32
#include <io.h>
#endif
+#include "parallel.h"
+#include "pg_backup_archiver.h"
+#include "pg_backup_db.h"
+#include "pg_backup_utils.h"
+#include "dumputils.h"
+#include "fe_utils/string_utils.h"
+
#include "libpq/libpq-fs.h"
#define TEXT_DUMP_HEADER "--\n-- PostgreSQL database dump\n--\n\n"
#include <unistd.h>
#include <ctype.h>
-#ifdef ENABLE_NLS
-#include <locale.h>
-#endif
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#endif
#include <time.h>
#include <unistd.h>
-#ifdef ENABLE_NLS
-#include <locale.h>
-#endif
-
#include "getopt_long.h"
#include "dumputils.h"
*/
#include "postgres_fe.h"
-#include "getopt_long.h"
-
-#include "dumputils.h"
-#include "parallel.h"
-#include "pg_backup_utils.h"
-
#include <ctype.h>
-
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#endif
-#ifdef ENABLE_NLS
-#include <locale.h>
-#endif
+#include "getopt_long.h"
+
+#include "dumputils.h"
+#include "parallel.h"
+#include "pg_backup_utils.h"
static void usage(const char *progname);
#include <dirent.h>
#include <fcntl.h>
-#include <locale.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
*/
#include "postgres_fe.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <fcntl.h>
#include <unistd.h>
-#include <string.h>
#include "datapagemap.h"
#include "fetch.h"
*/
#include "postgres_fe.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
*/
#include "postgres_fe.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "postgres_fe.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
*/
#include "postgres_fe.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <fcntl.h>
#include "pg_upgrade.h"
-#include <sys/types.h>
#include "fe_utils/string_utils.h"
#include "postgres_fe.h"
-#include "pg_upgrade.h"
-
#include <fcntl.h>
-#include <sys/types.h>
+
+#include "pg_upgrade.h"
static void check_data_dir(ClusterInfo *cluster);
static void check_bin_dir(ClusterInfo *cluster);
#include "postgres_fe.h"
-#include "miscadmin.h"
-#include "getopt_long.h"
-
-#include "pg_upgrade.h"
-
#include <time.h>
-#include <sys/types.h>
#ifdef WIN32
#include <io.h>
#endif
+#include "miscadmin.h"
+#include "getopt_long.h"
+
+#include "pg_upgrade.h"
+
static void usage(void);
static void check_required_directory(char **dirpath, char **configpath,
#include "postgres_fe.h"
-#include "pg_upgrade.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
#include <sys/wait.h>
-
#ifdef WIN32
#include <io.h>
#endif
+#include "pg_upgrade.h"
+
+
static int parallel_jobs;
#ifdef WIN32
#include "pg_upgrade.h"
-#include <sys/types.h>
-
static void get_tablespace_paths(void);
static void set_tablespace_directory_suffix(ClusterInfo *cluster);
*
*-------------------------------------------------------------------------
*/
-
-
#include "postgres_fe.h"
-#include <windows.h>
#include <olectl.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
/* Global variables */
HANDLE g_module = NULL; /* hModule of DLL */
#include <pwd.h>
#endif
#ifndef WIN32
-#include <sys/types.h> /* for umask() */
#include <sys/stat.h> /* for stat() */
#include <fcntl.h> /* open() flags */
#include <unistd.h> /* for geteuid(), getpid(), stat() */
#include <io.h>
#include <fcntl.h>
#include <direct.h>
-#include <sys/types.h> /* for umask() */
#include <sys/stat.h> /* for stat() */
#endif
*/
#include "postgres_fe.h"
-#include <string.h>
-
#include "common.h"
#include "crosstabview.h"
#include "pqexpbuffer.h"
#include "postgres_fe.h"
#ifndef WIN32
-#include <sys/types.h> /* (ditto) */
#include <unistd.h> /* for geteuid() */
#else
#include <win32.h>
*/
#include "postgres_fe.h"
-#include <sys/types.h>
-
#ifndef WIN32
#include <unistd.h>
#else /* WIN32 */
#include "getopt_long.h"
-#include <locale.h>
-
#include "command.h"
#include "common.h"
#include "describe.h"
#endif
#include <unistd.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netdb.h>
#include "postgres_fe.h"
#endif
-#include <errno.h>
#include <pwd.h>
#include <unistd.h>
-#include <sys/types.h>
#include "common/username.h"
#endif
#include <signal.h>
-#include <stdio.h>
-#include <string.h>
#include <sys/wait.h>
/*
#include "postgres_fe.h"
#include <limits.h>
-#include <locale.h>
#include <math.h>
#include <signal.h>
#include <unistd.h>
#ifndef LIBPQ_H
#define LIBPQ_H
-#include <sys/types.h>
#include <netinet/in.h>
#include "lib/stringinfo.h"
*-------------------------------------------------------------------------
*/
#include <intrin.h>
-#include <windows.h>
/* intentionally no include guards, should only be included by atomics.h */
#ifndef INSIDE_ATOMICS_H
#ifndef _PG_LOCALE_
#define _PG_LOCALE_
-#include <locale.h>
#if defined(LOCALE_T_IN_XLOCALE) || defined(WCSTOMBS_L_IN_XLOCALE)
#include <xlocale.h>
#endif
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
-#include <stdlib.h>
-#include <string.h>
#include <float.h>
#include <math.h>
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
-#include <locale.h>
#include <float.h>
#include <math.h>
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
-#include <stdlib.h>
#include "ecpgtype.h"
#include "ecpglib.h"
#include "extern.h"
#include "postgres_fe.h"
#include <unistd.h>
-#include <string.h>
+
#include "getopt_long.h"
#include "extern.h"
#include "postgres_fe.h"
#include <ctype.h>
-#include <sys/types.h>
#include <limits.h>
#include "extern.h"
#include "postgres_fe.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
#include "libpq-events.h"
#include <time.h>
-#include <sys/types.h>
#ifndef WIN32
#include <sys/time.h>
#endif
#include "postgres_fe.h"
-#include <windows.h>
#include "pthread-win32.h"
DWORD
#include <ctype.h>
#include <fcntl.h>
#include <limits.h>
-#include <locale.h>
#include <unistd.h>
/* postgreSQL stuff */
#include "postgres_fe.h"
#endif
-#if defined(WIN32) && (_MSC_VER >= 1900)
-#include <windows.h>
-#endif
-
-#include <locale.h>
#ifdef HAVE_LANGINFO_H
#include <langinfo.h>
#endif
#ifndef __CYGWIN__
#include <winioctl.h>
#else
-#include <windows.h>
#include <w32api/winioctl.h>
#endif
#endif
#include "postgres_fe.h"
#endif
-#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "postgres_fe.h"
#endif
-#include <windows.h>
#include <fcntl.h>
#include <assert.h>
#include "postgres_fe.h"
#endif
-#include <windows.h>
#include <fcntl.h>
#undef system
#include "postgres_fe.h"
-#ifdef WIN32
-#include <windows.h>
-#endif
#include <sys/time.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#include "postgres.h"
#include <fcntl.h>
-#include <locale.h>
#include "private.h"
#include "tzfile.h"
#include "postgres_fe.h"
#include <fcntl.h>
-#include <locale.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>