From b85a965f5fc7243d0386085e12f7a6c836503b42 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 11 Jul 2006 13:54:25 +0000 Subject: [PATCH] Allow each C include file to compile on its own by including any needed header files. --- src/bin/pg_dump/pg_backup.h | 3 ++- src/bin/pg_dump/pg_backup_archiver.h | 48 +++++++++++++++++------------------ src/bin/pg_dump/pg_backup_db.h | 9 ++++++- src/include/access/gin.h | 6 +++-- src/include/commands/sequence.h | 3 ++- src/include/port.h | 6 ++++- src/include/rewrite/rewriteHandler.h | 3 ++- src/include/utils/inet.h | 4 ++- src/include/utils/numeric.h | 4 ++- src/include/utils/syscache.h | 3 ++- src/interfaces/ecpg/include/ecpglib.h | 5 ++-- src/timezone/pgtz.h | 3 ++- src/tools/pginclude/README | 3 ++- 13 files changed, 62 insertions(+), 38 deletions(-) diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h index 9f0f7ca3ca..cc49aadc71 100644 --- a/src/bin/pg_dump/pg_backup.h +++ b/src/bin/pg_dump/pg_backup.h @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup.h,v 1.39 2006/05/28 21:13:54 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup.h,v 1.40 2006/07/11 13:54:24 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -26,6 +26,7 @@ #include "postgres_fe.h" #include "pg_dump.h" +#include "dumputils.h" #include "libpq-fe.h" #include "pqexpbuffer.h" diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h index 1b6f6a1d8f..b53ff9fbc3 100644 --- a/src/bin/pg_dump/pg_backup_archiver.h +++ b/src/bin/pg_dump/pg_backup_archiver.h @@ -17,7 +17,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.70 2006/05/28 21:13:54 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.71 2006/07/11 13:54:24 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -98,29 +98,29 @@ struct _archiveHandle; struct _tocEntry; struct _restoreList; -typedef void (*ClosePtr) (struct _archiveHandle * AH); -typedef void (*ArchiveEntryPtr) (struct _archiveHandle * AH, struct _tocEntry * te); - -typedef void (*StartDataPtr) (struct _archiveHandle * AH, struct _tocEntry * te); -typedef size_t (*WriteDataPtr) (struct _archiveHandle * AH, const void *data, size_t dLen); -typedef void (*EndDataPtr) (struct _archiveHandle * AH, struct _tocEntry * te); - -typedef void (*StartBlobsPtr) (struct _archiveHandle * AH, struct _tocEntry * te); -typedef void (*StartBlobPtr) (struct _archiveHandle * AH, struct _tocEntry * te, Oid oid); -typedef void (*EndBlobPtr) (struct _archiveHandle * AH, struct _tocEntry * te, Oid oid); -typedef void (*EndBlobsPtr) (struct _archiveHandle * AH, struct _tocEntry * te); - -typedef int (*WriteBytePtr) (struct _archiveHandle * AH, const int i); -typedef int (*ReadBytePtr) (struct _archiveHandle * AH); -typedef size_t (*WriteBufPtr) (struct _archiveHandle * AH, const void *c, size_t len); -typedef size_t (*ReadBufPtr) (struct _archiveHandle * AH, void *buf, size_t len); -typedef void (*SaveArchivePtr) (struct _archiveHandle * AH); -typedef void (*WriteExtraTocPtr) (struct _archiveHandle * AH, struct _tocEntry * te); -typedef void (*ReadExtraTocPtr) (struct _archiveHandle * AH, struct _tocEntry * te); -typedef void (*PrintExtraTocPtr) (struct _archiveHandle * AH, struct _tocEntry * te); -typedef void (*PrintTocDataPtr) (struct _archiveHandle * AH, struct _tocEntry * te, RestoreOptions *ropt); - -typedef size_t (*CustomOutPtr) (struct _archiveHandle * AH, const void *buf, size_t len); +typedef void (*ClosePtr) (struct _archiveHandle *AH); +typedef void (*ArchiveEntryPtr) (struct _archiveHandle *AH, struct _tocEntry *te); + +typedef void (*StartDataPtr) (struct _archiveHandle *AH, struct _tocEntry *te); +typedef size_t (*WriteDataPtr) (struct _archiveHandle *AH, const void *data, size_t dLen); +typedef void (*EndDataPtr) (struct _archiveHandle *AH, struct _tocEntry *te); + +typedef void (*StartBlobsPtr) (struct _archiveHandle *AH, struct _tocEntry *te); +typedef void (*StartBlobPtr) (struct _archiveHandle *AH, struct _tocEntry *te, Oid oid); +typedef void (*EndBlobPtr) (struct _archiveHandle *AH, struct _tocEntry *te, Oid oid); +typedef void (*EndBlobsPtr) (struct _archiveHandle *AH, struct _tocEntry *te); + +typedef int (*WriteBytePtr) (struct _archiveHandle *AH, const int i); +typedef int (*ReadBytePtr) (struct _archiveHandle *AH); +typedef size_t (*WriteBufPtr) (struct _archiveHandle *AH, const void *c, size_t len); +typedef size_t (*ReadBufPtr) (struct _archiveHandle *AH, void *buf, size_t len); +typedef void (*SaveArchivePtr) (struct _archiveHandle *AH); +typedef void (*WriteExtraTocPtr) (struct _archiveHandle *AH, struct _tocEntry *te); +typedef void (*ReadExtraTocPtr) (struct _archiveHandle *AH, struct _tocEntry *te); +typedef void (*PrintExtraTocPtr) (struct _archiveHandle *AH, struct _tocEntry *te); +typedef void (*PrintTocDataPtr) (struct _archiveHandle *AH, struct _tocEntry *te, RestoreOptions *ropt); + +typedef size_t (*CustomOutPtr) (struct _archiveHandle *AH, const void *buf, size_t len); typedef enum _archiveMode { diff --git a/src/bin/pg_dump/pg_backup_db.h b/src/bin/pg_dump/pg_backup_db.h index 52fa8f63cd..9b42f80c4e 100644 --- a/src/bin/pg_dump/pg_backup_db.h +++ b/src/bin/pg_dump/pg_backup_db.h @@ -2,11 +2,18 @@ * Definitions for pg_backup_db.c * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.h,v 1.11 2005/06/21 20:45:44 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.h,v 1.12 2006/07/11 13:54:24 momjian Exp $ */ +#ifndef PG_BACKUP_DB_H +#define PG_BACKUP_DB_H + +#include "pg_backup_archiver.h" + extern int ExecuteSqlCommand(ArchiveHandle *AH, PQExpBuffer qry, char *desc); extern int ExecuteSqlCommandBuf(ArchiveHandle *AH, void *qry, size_t bufLen); extern void StartTransaction(ArchiveHandle *AH); extern void CommitTransaction(ArchiveHandle *AH); + +#endif diff --git a/src/include/access/gin.h b/src/include/access/gin.h index de3100c4ca..c13d726aa9 100644 --- a/src/include/access/gin.h +++ b/src/include/access/gin.h @@ -3,7 +3,7 @@ * header file for postgres inverted index access method implementation. * * Copyright (c) 2006, PostgreSQL Global Development Group - * $PostgreSQL: pgsql/src/include/access/gin.h,v 1.3 2006/07/03 22:45:39 tgl Exp $ + * $PostgreSQL: pgsql/src/include/access/gin.h,v 1.4 2006/07/11 13:54:24 momjian Exp $ *-------------------------------------------------------------------------- */ @@ -11,6 +11,8 @@ #ifndef GIN_H #define GIN_H +#include "access/relscan.h" +#include "access/skey.h" #include "access/xlog.h" #include "access/xlogdefs.h" #include "storage/bufpage.h" @@ -385,7 +387,7 @@ extern Datum ginendscan(PG_FUNCTION_ARGS); extern Datum ginrescan(PG_FUNCTION_ARGS); extern Datum ginmarkpos(PG_FUNCTION_ARGS); extern Datum ginrestrpos(PG_FUNCTION_ARGS); -extern void newScanKey( IndexScanDesc scan ); +extern void newScanKey(IndexScanDesc scan); /* ginget.c */ extern DLLIMPORT int GinFuzzySearchLimit; diff --git a/src/include/commands/sequence.h b/src/include/commands/sequence.h index f334d6ba83..03c7cb4470 100644 --- a/src/include/commands/sequence.h +++ b/src/include/commands/sequence.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/commands/sequence.h,v 1.36 2006/03/24 04:32:13 tgl Exp $ + * $PostgreSQL: pgsql/src/include/commands/sequence.h,v 1.37 2006/07/11 13:54:24 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -14,6 +14,7 @@ #define SEQUENCE_H #include "nodes/parsenodes.h" +#include "storage/relfilenode.h" #include "access/xlog.h" #include "fmgr.h" diff --git a/src/include/port.h b/src/include/port.h index 7cb5608394..e7747a88d9 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.93 2006/06/25 00:18:24 momjian Exp $ + * $PostgreSQL: pgsql/src/include/port.h,v 1.94 2006/07/11 13:54:24 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -184,6 +184,10 @@ extern char *simple_prompt(const char *prompt, int maxlen, bool echo); * pgpipe, but in other cases we define rename to pgrename just on Win32. */ #ifndef WIN32 +/* + * The function prototypes are not supplied because every C file + * includes this file. + */ #define pgpipe(a) pipe(a) #define piperead(a,b,c) read(a,b,c) #define pipewrite(a,b,c) write(a,b,c) diff --git a/src/include/rewrite/rewriteHandler.h b/src/include/rewrite/rewriteHandler.h index 17938516f4..dddcfc036a 100644 --- a/src/include/rewrite/rewriteHandler.h +++ b/src/include/rewrite/rewriteHandler.h @@ -7,13 +7,14 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/rewrite/rewriteHandler.h,v 1.26 2006/03/05 15:58:58 momjian Exp $ + * $PostgreSQL: pgsql/src/include/rewrite/rewriteHandler.h,v 1.27 2006/07/11 13:54:24 momjian Exp $ * *------------------------------------------------------------------------- */ #ifndef REWRITEHANDLER_H #define REWRITEHANDLER_H +#include "utils/rel.h" #include "nodes/parsenodes.h" extern List *QueryRewrite(Query *parsetree); diff --git a/src/include/utils/inet.h b/src/include/utils/inet.h index d0b1190029..8a50edf3a6 100644 --- a/src/include/utils/inet.h +++ b/src/include/utils/inet.h @@ -7,13 +7,15 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/inet.h,v 1.23 2006/03/05 15:59:07 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/inet.h,v 1.24 2006/07/11 13:54:24 momjian Exp $ * *------------------------------------------------------------------------- */ #ifndef INET_H #define INET_H +#include "fmgr.h" + /* * This is the internal storage format for IP addresses * (both INET and CIDR datatypes): diff --git a/src/include/utils/numeric.h b/src/include/utils/numeric.h index 1e2888a85f..e2103eb30e 100644 --- a/src/include/utils/numeric.h +++ b/src/include/utils/numeric.h @@ -7,13 +7,15 @@ * * Copyright (c) 1998-2006, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/utils/numeric.h,v 1.21 2006/03/05 15:59:07 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/numeric.h,v 1.22 2006/07/11 13:54:24 momjian Exp $ * *------------------------------------------------------------------------- */ #ifndef _PG_NUMERIC_H_ #define _PG_NUMERIC_H_ +#include "fmgr.h" + /* * Hardcoded precision limit - arbitrary, but must be small enough that * dscale values will fit in 14 bits. diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h index 34ef6132b3..89e049a72b 100644 --- a/src/include/utils/syscache.h +++ b/src/include/utils/syscache.h @@ -9,7 +9,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/syscache.h,v 1.63 2006/05/03 22:45:26 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/syscache.h,v 1.64 2006/07/11 13:54:24 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -17,6 +17,7 @@ #define SYSCACHE_H #include "access/htup.h" +#include "utils/catcache.h" /* * Declarations for util/syscache.c. diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h index 981aabefa7..8998f40079 100644 --- a/src/interfaces/ecpg/include/ecpglib.h +++ b/src/interfaces/ecpg/include/ecpglib.h @@ -1,7 +1,7 @@ /* * this is a small part of c.h since we don't want to leak all postgres * definitions into ecpg programs - * $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.66 2006/03/11 04:38:39 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.67 2006/07/11 13:54:25 momjian Exp $ */ #ifndef _ECPGLIB_H @@ -9,6 +9,7 @@ #include "libpq-fe.h" #include "ecpgtype.h" +#include "sqlca.h" #include #ifndef __cplusplus @@ -39,7 +40,7 @@ extern "C" struct sqlca_t; -void ECPGinit_sqlca(struct sqlca_t * sqlca); +void ECPGinit_sqlca(struct sqlca_t *sqlca); void ECPGdebug(int, FILE *); bool ECPGstatus(int, const char *); bool ECPGsetcommit(int, const char *, const char *); diff --git a/src/timezone/pgtz.h b/src/timezone/pgtz.h index c22c95bb72..b58613bb62 100644 --- a/src/timezone/pgtz.h +++ b/src/timezone/pgtz.h @@ -9,7 +9,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/timezone/pgtz.h,v 1.16 2006/03/05 15:59:11 momjian Exp $ + * $PostgreSQL: pgsql/src/timezone/pgtz.h,v 1.17 2006/07/11 13:54:25 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -17,6 +17,7 @@ #define _PGTZ_H #include "tzfile.h" +#include "pgtime.h" extern char *pg_TZDIR(void); diff --git a/src/tools/pginclude/README b/src/tools/pginclude/README index 93b8f2777d..893cdd6303 100644 --- a/src/tools/pginclude/README +++ b/src/tools/pginclude/README @@ -13,4 +13,5 @@ pgrminclude [-v] pgdefine create macro calls for all defines in the file (used by the above routines) - +It is also a good idea to sort the pg-specific include files in alphabetic +order. This is best done with a text editor. -- 2.11.0