pg_dump: Rename some typedefs to avoid name conflicts

In struct _archiveHandle, some of the fields have the same name as a
typedef.  This is kind of confusing, so rename the types so they have
names distinct from the struct fields.  In C++, the previous coding
changes the meaning of the typedef in the scope of the struct, causing
warnings and possibly other problems.

Reviewed-by: Andres Freund <andres@anarazel.de>
This commit is contained in:
Peter Eisentraut 2016-08-30 12:00:00 -04:00
parent 20c95f27e7
commit 4be613f692
3 changed files with 55 additions and 55 deletions

View File

@ -230,7 +230,7 @@ typedef int DumpId;
typedef int (*DataDumperPtr) (Archive *AH, void *userArg); typedef int (*DataDumperPtr) (Archive *AH, void *userArg);
typedef void (*SetupWorkerPtr) (Archive *AH); typedef void (*SetupWorkerPtrType) (Archive *AH);
/* /*
* Main archiver interface. * Main archiver interface.
@ -277,7 +277,7 @@ extern Archive *OpenArchive(const char *FileSpec, const ArchiveFormat fmt);
/* Create a new archive */ /* Create a new archive */
extern Archive *CreateArchive(const char *FileSpec, const ArchiveFormat fmt, extern Archive *CreateArchive(const char *FileSpec, const ArchiveFormat fmt,
const int compression, bool dosync, ArchiveMode mode, const int compression, bool dosync, ArchiveMode mode,
SetupWorkerPtr setupDumpWorker); SetupWorkerPtrType setupDumpWorker);
/* The --list option */ /* The --list option */
extern void PrintTOCSummary(Archive *AH); extern void PrintTOCSummary(Archive *AH);

View File

@ -55,7 +55,7 @@ static const char *modulename = gettext_noop("archiver");
static ArchiveHandle *_allocAH(const char *FileSpec, const ArchiveFormat fmt, static ArchiveHandle *_allocAH(const char *FileSpec, const ArchiveFormat fmt,
const int compression, bool dosync, ArchiveMode mode, const int compression, bool dosync, ArchiveMode mode,
SetupWorkerPtr setupWorkerPtr); SetupWorkerPtrType setupWorkerPtr);
static void _getObjectDescription(PQExpBuffer buf, TocEntry *te, static void _getObjectDescription(PQExpBuffer buf, TocEntry *te,
ArchiveHandle *AH); ArchiveHandle *AH);
static void _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData, bool acl_pass); static void _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData, bool acl_pass);
@ -204,7 +204,7 @@ setupRestoreWorker(Archive *AHX)
Archive * Archive *
CreateArchive(const char *FileSpec, const ArchiveFormat fmt, CreateArchive(const char *FileSpec, const ArchiveFormat fmt,
const int compression, bool dosync, ArchiveMode mode, const int compression, bool dosync, ArchiveMode mode,
SetupWorkerPtr setupDumpWorker) SetupWorkerPtrType setupDumpWorker)
{ {
ArchiveHandle *AH = _allocAH(FileSpec, fmt, compression, dosync, ArchiveHandle *AH = _allocAH(FileSpec, fmt, compression, dosync,
@ -2273,7 +2273,7 @@ _discoverArchiveFormat(ArchiveHandle *AH)
static ArchiveHandle * static ArchiveHandle *
_allocAH(const char *FileSpec, const ArchiveFormat fmt, _allocAH(const char *FileSpec, const ArchiveFormat fmt,
const int compression, bool dosync, ArchiveMode mode, const int compression, bool dosync, ArchiveMode mode,
SetupWorkerPtr setupWorkerPtr) SetupWorkerPtrType setupWorkerPtr)
{ {
ArchiveHandle *AH; ArchiveHandle *AH;
@ -2446,8 +2446,8 @@ mark_dump_job_done(ArchiveHandle *AH,
void void
WriteDataChunksForTocEntry(ArchiveHandle *AH, TocEntry *te) WriteDataChunksForTocEntry(ArchiveHandle *AH, TocEntry *te)
{ {
StartDataPtr startPtr; StartDataPtrType startPtr;
EndDataPtr endPtr; EndDataPtrType endPtr;
AH->currToc = te; AH->currToc = te;

View File

@ -143,36 +143,36 @@ typedef enum T_Action
ACT_RESTORE ACT_RESTORE
} T_Action; } T_Action;
typedef void (*ClosePtr) (ArchiveHandle *AH); typedef void (*ClosePtrType) (ArchiveHandle *AH);
typedef void (*ReopenPtr) (ArchiveHandle *AH); typedef void (*ReopenPtrType) (ArchiveHandle *AH);
typedef void (*ArchiveEntryPtr) (ArchiveHandle *AH, TocEntry *te); typedef void (*ArchiveEntryPtrType) (ArchiveHandle *AH, TocEntry *te);
typedef void (*StartDataPtr) (ArchiveHandle *AH, TocEntry *te); typedef void (*StartDataPtrType) (ArchiveHandle *AH, TocEntry *te);
typedef void (*WriteDataPtr) (ArchiveHandle *AH, const void *data, size_t dLen); typedef void (*WriteDataPtrType) (ArchiveHandle *AH, const void *data, size_t dLen);
typedef void (*EndDataPtr) (ArchiveHandle *AH, TocEntry *te); typedef void (*EndDataPtrType) (ArchiveHandle *AH, TocEntry *te);
typedef void (*StartBlobsPtr) (ArchiveHandle *AH, TocEntry *te); typedef void (*StartBlobsPtrType) (ArchiveHandle *AH, TocEntry *te);
typedef void (*StartBlobPtr) (ArchiveHandle *AH, TocEntry *te, Oid oid); typedef void (*StartBlobPtrType) (ArchiveHandle *AH, TocEntry *te, Oid oid);
typedef void (*EndBlobPtr) (ArchiveHandle *AH, TocEntry *te, Oid oid); typedef void (*EndBlobPtrType) (ArchiveHandle *AH, TocEntry *te, Oid oid);
typedef void (*EndBlobsPtr) (ArchiveHandle *AH, TocEntry *te); typedef void (*EndBlobsPtrType) (ArchiveHandle *AH, TocEntry *te);
typedef int (*WriteBytePtr) (ArchiveHandle *AH, const int i); typedef int (*WriteBytePtrType) (ArchiveHandle *AH, const int i);
typedef int (*ReadBytePtr) (ArchiveHandle *AH); typedef int (*ReadBytePtrType) (ArchiveHandle *AH);
typedef void (*WriteBufPtr) (ArchiveHandle *AH, const void *c, size_t len); typedef void (*WriteBufPtrType) (ArchiveHandle *AH, const void *c, size_t len);
typedef void (*ReadBufPtr) (ArchiveHandle *AH, void *buf, size_t len); typedef void (*ReadBufPtrType) (ArchiveHandle *AH, void *buf, size_t len);
typedef void (*SaveArchivePtr) (ArchiveHandle *AH); typedef void (*SaveArchivePtrType) (ArchiveHandle *AH);
typedef void (*WriteExtraTocPtr) (ArchiveHandle *AH, TocEntry *te); typedef void (*WriteExtraTocPtrType) (ArchiveHandle *AH, TocEntry *te);
typedef void (*ReadExtraTocPtr) (ArchiveHandle *AH, TocEntry *te); typedef void (*ReadExtraTocPtrType) (ArchiveHandle *AH, TocEntry *te);
typedef void (*PrintExtraTocPtr) (ArchiveHandle *AH, TocEntry *te); typedef void (*PrintExtraTocPtrType) (ArchiveHandle *AH, TocEntry *te);
typedef void (*PrintTocDataPtr) (ArchiveHandle *AH, TocEntry *te); typedef void (*PrintTocDataPtrType) (ArchiveHandle *AH, TocEntry *te);
typedef void (*ClonePtr) (ArchiveHandle *AH); typedef void (*ClonePtrType) (ArchiveHandle *AH);
typedef void (*DeClonePtr) (ArchiveHandle *AH); typedef void (*DeClonePtrType) (ArchiveHandle *AH);
typedef int (*WorkerJobDumpPtr) (ArchiveHandle *AH, TocEntry *te); typedef int (*WorkerJobDumpPtrType) (ArchiveHandle *AH, TocEntry *te);
typedef int (*WorkerJobRestorePtr) (ArchiveHandle *AH, TocEntry *te); typedef int (*WorkerJobRestorePtrType) (ArchiveHandle *AH, TocEntry *te);
typedef size_t (*CustomOutPtr) (ArchiveHandle *AH, const void *buf, size_t len); typedef size_t (*CustomOutPtrType) (ArchiveHandle *AH, const void *buf, size_t len);
typedef enum typedef enum
{ {
@ -242,39 +242,39 @@ struct _archiveHandle
size_t lookaheadLen; /* Length of data in lookahead */ size_t lookaheadLen; /* Length of data in lookahead */
pgoff_t lookaheadPos; /* Current read position in lookahead buffer */ pgoff_t lookaheadPos; /* Current read position in lookahead buffer */
ArchiveEntryPtr ArchiveEntryPtr; /* Called for each metadata object */ ArchiveEntryPtrType ArchiveEntryPtr; /* Called for each metadata object */
StartDataPtr StartDataPtr; /* Called when table data is about to be StartDataPtrType StartDataPtr; /* Called when table data is about to be
* dumped */ * dumped */
WriteDataPtr WriteDataPtr; /* Called to send some table data to the WriteDataPtrType WriteDataPtr; /* Called to send some table data to the
* archive */ * archive */
EndDataPtr EndDataPtr; /* Called when table data dump is finished */ EndDataPtrType EndDataPtr; /* Called when table data dump is finished */
WriteBytePtr WriteBytePtr; /* Write a byte to output */ WriteBytePtrType WriteBytePtr; /* Write a byte to output */
ReadBytePtr ReadBytePtr; /* Read a byte from an archive */ ReadBytePtrType ReadBytePtr; /* Read a byte from an archive */
WriteBufPtr WriteBufPtr; /* Write a buffer of output to the archive */ WriteBufPtrType WriteBufPtr; /* Write a buffer of output to the archive */
ReadBufPtr ReadBufPtr; /* Read a buffer of input from the archive */ ReadBufPtrType ReadBufPtr; /* Read a buffer of input from the archive */
ClosePtr ClosePtr; /* Close the archive */ ClosePtrType ClosePtr; /* Close the archive */
ReopenPtr ReopenPtr; /* Reopen the archive */ ReopenPtrType ReopenPtr; /* Reopen the archive */
WriteExtraTocPtr WriteExtraTocPtr; /* Write extra TOC entry data WriteExtraTocPtrType WriteExtraTocPtr; /* Write extra TOC entry data
* associated with the current archive * associated with the current archive
* format */ * format */
ReadExtraTocPtr ReadExtraTocPtr; /* Read extr info associated with ReadExtraTocPtrType ReadExtraTocPtr; /* Read extr info associated with
* archie format */ * archie format */
PrintExtraTocPtr PrintExtraTocPtr; /* Extra TOC info for format */ PrintExtraTocPtrType PrintExtraTocPtr; /* Extra TOC info for format */
PrintTocDataPtr PrintTocDataPtr; PrintTocDataPtrType PrintTocDataPtr;
StartBlobsPtr StartBlobsPtr; StartBlobsPtrType StartBlobsPtr;
EndBlobsPtr EndBlobsPtr; EndBlobsPtrType EndBlobsPtr;
StartBlobPtr StartBlobPtr; StartBlobPtrType StartBlobPtr;
EndBlobPtr EndBlobPtr; EndBlobPtrType EndBlobPtr;
SetupWorkerPtr SetupWorkerPtr; SetupWorkerPtrType SetupWorkerPtr;
WorkerJobDumpPtr WorkerJobDumpPtr; WorkerJobDumpPtrType WorkerJobDumpPtr;
WorkerJobRestorePtr WorkerJobRestorePtr; WorkerJobRestorePtrType WorkerJobRestorePtr;
ClonePtr ClonePtr; /* Clone format-specific fields */ ClonePtrType ClonePtr; /* Clone format-specific fields */
DeClonePtr DeClonePtr; /* Clean up cloned fields */ DeClonePtrType DeClonePtr; /* Clean up cloned fields */
CustomOutPtr CustomOutPtr; /* Alternative script output routine */ CustomOutPtrType CustomOutPtr; /* Alternative script output routine */
/* Stuff for direct DB connection */ /* Stuff for direct DB connection */
char *archdbname; /* DB name *read* from archive */ char *archdbname; /* DB name *read* from archive */