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

Commit4be613f

Browse files
committed
pg_dump: Rename some typedefs to avoid name conflicts
In struct _archiveHandle, some of the fields have the same name as atypedef. This is kind of confusing, so rename the types so they havenames distinct from the struct fields. In C++, the previous codingchanges the meaning of the typedef in the scope of the struct, causingwarnings and possibly other problems.Reviewed-by: Andres Freund <andres@anarazel.de>
1 parent20c95f2 commit4be613f

File tree

3 files changed

+55
-55
lines changed

3 files changed

+55
-55
lines changed

‎src/bin/pg_dump/pg_backup.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ typedef int DumpId;
230230

231231
typedefint (*DataDumperPtr) (Archive*AH,void*userArg);
232232

233-
typedefvoid (*SetupWorkerPtr) (Archive*AH);
233+
typedefvoid (*SetupWorkerPtrType) (Archive*AH);
234234

235235
/*
236236
* Main archiver interface.
@@ -277,7 +277,7 @@ extern Archive *OpenArchive(const char *FileSpec, const ArchiveFormat fmt);
277277
/* Create a new archive */
278278
externArchive*CreateArchive(constchar*FileSpec,constArchiveFormatfmt,
279279
constintcompression,booldosync,ArchiveModemode,
280-
SetupWorkerPtrsetupDumpWorker);
280+
SetupWorkerPtrTypesetupDumpWorker);
281281

282282
/* The --list option */
283283
externvoidPrintTOCSummary(Archive*AH);

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static const char *modulename = gettext_noop("archiver");
5555

5656
staticArchiveHandle*_allocAH(constchar*FileSpec,constArchiveFormatfmt,
5757
constintcompression,booldosync,ArchiveModemode,
58-
SetupWorkerPtrsetupWorkerPtr);
58+
SetupWorkerPtrTypesetupWorkerPtr);
5959
staticvoid_getObjectDescription(PQExpBufferbuf,TocEntry*te,
6060
ArchiveHandle*AH);
6161
staticvoid_printTocEntry(ArchiveHandle*AH,TocEntry*te,boolisData,boolacl_pass);
@@ -204,7 +204,7 @@ setupRestoreWorker(Archive *AHX)
204204
Archive*
205205
CreateArchive(constchar*FileSpec,constArchiveFormatfmt,
206206
constintcompression,booldosync,ArchiveModemode,
207-
SetupWorkerPtrsetupDumpWorker)
207+
SetupWorkerPtrTypesetupDumpWorker)
208208

209209
{
210210
ArchiveHandle*AH=_allocAH(FileSpec,fmt,compression,dosync,
@@ -2273,7 +2273,7 @@ _discoverArchiveFormat(ArchiveHandle *AH)
22732273
staticArchiveHandle*
22742274
_allocAH(constchar*FileSpec,constArchiveFormatfmt,
22752275
constintcompression,booldosync,ArchiveModemode,
2276-
SetupWorkerPtrsetupWorkerPtr)
2276+
SetupWorkerPtrTypesetupWorkerPtr)
22772277
{
22782278
ArchiveHandle*AH;
22792279

@@ -2446,8 +2446,8 @@ mark_dump_job_done(ArchiveHandle *AH,
24462446
void
24472447
WriteDataChunksForTocEntry(ArchiveHandle*AH,TocEntry*te)
24482448
{
2449-
StartDataPtrstartPtr;
2450-
EndDataPtrendPtr;
2449+
StartDataPtrTypestartPtr;
2450+
EndDataPtrTypeendPtr;
24512451

24522452
AH->currToc=te;
24532453

‎src/bin/pg_dump/pg_backup_archiver.h

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -143,36 +143,36 @@ typedef enum T_Action
143143
ACT_RESTORE
144144
}T_Action;
145145

146-
typedefvoid (*ClosePtr) (ArchiveHandle*AH);
147-
typedefvoid (*ReopenPtr) (ArchiveHandle*AH);
148-
typedefvoid (*ArchiveEntryPtr) (ArchiveHandle*AH,TocEntry*te);
146+
typedefvoid (*ClosePtrType) (ArchiveHandle*AH);
147+
typedefvoid (*ReopenPtrType) (ArchiveHandle*AH);
148+
typedefvoid (*ArchiveEntryPtrType) (ArchiveHandle*AH,TocEntry*te);
149149

150-
typedefvoid (*StartDataPtr) (ArchiveHandle*AH,TocEntry*te);
151-
typedefvoid (*WriteDataPtr) (ArchiveHandle*AH,constvoid*data,size_tdLen);
152-
typedefvoid (*EndDataPtr) (ArchiveHandle*AH,TocEntry*te);
150+
typedefvoid (*StartDataPtrType) (ArchiveHandle*AH,TocEntry*te);
151+
typedefvoid (*WriteDataPtrType) (ArchiveHandle*AH,constvoid*data,size_tdLen);
152+
typedefvoid (*EndDataPtrType) (ArchiveHandle*AH,TocEntry*te);
153153

154-
typedefvoid (*StartBlobsPtr) (ArchiveHandle*AH,TocEntry*te);
155-
typedefvoid (*StartBlobPtr) (ArchiveHandle*AH,TocEntry*te,Oidoid);
156-
typedefvoid (*EndBlobPtr) (ArchiveHandle*AH,TocEntry*te,Oidoid);
157-
typedefvoid (*EndBlobsPtr) (ArchiveHandle*AH,TocEntry*te);
154+
typedefvoid (*StartBlobsPtrType) (ArchiveHandle*AH,TocEntry*te);
155+
typedefvoid (*StartBlobPtrType) (ArchiveHandle*AH,TocEntry*te,Oidoid);
156+
typedefvoid (*EndBlobPtrType) (ArchiveHandle*AH,TocEntry*te,Oidoid);
157+
typedefvoid (*EndBlobsPtrType) (ArchiveHandle*AH,TocEntry*te);
158158

159-
typedefint (*WriteBytePtr) (ArchiveHandle*AH,constinti);
160-
typedefint (*ReadBytePtr) (ArchiveHandle*AH);
161-
typedefvoid (*WriteBufPtr) (ArchiveHandle*AH,constvoid*c,size_tlen);
162-
typedefvoid (*ReadBufPtr) (ArchiveHandle*AH,void*buf,size_tlen);
163-
typedefvoid (*SaveArchivePtr) (ArchiveHandle*AH);
164-
typedefvoid (*WriteExtraTocPtr) (ArchiveHandle*AH,TocEntry*te);
165-
typedefvoid (*ReadExtraTocPtr) (ArchiveHandle*AH,TocEntry*te);
166-
typedefvoid (*PrintExtraTocPtr) (ArchiveHandle*AH,TocEntry*te);
167-
typedefvoid (*PrintTocDataPtr) (ArchiveHandle*AH,TocEntry*te);
159+
typedefint (*WriteBytePtrType) (ArchiveHandle*AH,constinti);
160+
typedefint (*ReadBytePtrType) (ArchiveHandle*AH);
161+
typedefvoid (*WriteBufPtrType) (ArchiveHandle*AH,constvoid*c,size_tlen);
162+
typedefvoid (*ReadBufPtrType) (ArchiveHandle*AH,void*buf,size_tlen);
163+
typedefvoid (*SaveArchivePtrType) (ArchiveHandle*AH);
164+
typedefvoid (*WriteExtraTocPtrType) (ArchiveHandle*AH,TocEntry*te);
165+
typedefvoid (*ReadExtraTocPtrType) (ArchiveHandle*AH,TocEntry*te);
166+
typedefvoid (*PrintExtraTocPtrType) (ArchiveHandle*AH,TocEntry*te);
167+
typedefvoid (*PrintTocDataPtrType) (ArchiveHandle*AH,TocEntry*te);
168168

169-
typedefvoid (*ClonePtr) (ArchiveHandle*AH);
170-
typedefvoid (*DeClonePtr) (ArchiveHandle*AH);
169+
typedefvoid (*ClonePtrType) (ArchiveHandle*AH);
170+
typedefvoid (*DeClonePtrType) (ArchiveHandle*AH);
171171

172-
typedefint (*WorkerJobDumpPtr) (ArchiveHandle*AH,TocEntry*te);
173-
typedefint (*WorkerJobRestorePtr) (ArchiveHandle*AH,TocEntry*te);
172+
typedefint (*WorkerJobDumpPtrType) (ArchiveHandle*AH,TocEntry*te);
173+
typedefint (*WorkerJobRestorePtrType) (ArchiveHandle*AH,TocEntry*te);
174174

175-
typedefsize_t (*CustomOutPtr) (ArchiveHandle*AH,constvoid*buf,size_tlen);
175+
typedefsize_t (*CustomOutPtrType) (ArchiveHandle*AH,constvoid*buf,size_tlen);
176176

177177
typedefenum
178178
{
@@ -242,39 +242,39 @@ struct _archiveHandle
242242
size_tlookaheadLen;/* Length of data in lookahead */
243243
pgoff_tlookaheadPos;/* Current read position in lookahead buffer */
244244

245-
ArchiveEntryPtrArchiveEntryPtr;/* Called for each metadata object */
246-
StartDataPtrStartDataPtr;/* Called when table data is about to be
245+
ArchiveEntryPtrTypeArchiveEntryPtr;/* Called for each metadata object */
246+
StartDataPtrTypeStartDataPtr;/* Called when table data is about to be
247247
* dumped */
248-
WriteDataPtrWriteDataPtr;/* Called to send some table data to the
248+
WriteDataPtrTypeWriteDataPtr;/* Called to send some table data to the
249249
* archive */
250-
EndDataPtrEndDataPtr;/* Called when table data dump is finished */
251-
WriteBytePtrWriteBytePtr;/* Write a byte to output */
252-
ReadBytePtrReadBytePtr;/* Read a byte from an archive */
253-
WriteBufPtrWriteBufPtr;/* Write a buffer of output to the archive */
254-
ReadBufPtrReadBufPtr;/* Read a buffer of input from the archive */
255-
ClosePtrClosePtr;/* Close the archive */
256-
ReopenPtrReopenPtr;/* Reopen the archive */
257-
WriteExtraTocPtrWriteExtraTocPtr;/* Write extra TOC entry data
250+
EndDataPtrTypeEndDataPtr;/* Called when table data dump is finished */
251+
WriteBytePtrTypeWriteBytePtr;/* Write a byte to output */
252+
ReadBytePtrTypeReadBytePtr;/* Read a byte from an archive */
253+
WriteBufPtrTypeWriteBufPtr;/* Write a buffer of output to the archive */
254+
ReadBufPtrTypeReadBufPtr;/* Read a buffer of input from the archive */
255+
ClosePtrTypeClosePtr;/* Close the archive */
256+
ReopenPtrTypeReopenPtr;/* Reopen the archive */
257+
WriteExtraTocPtrTypeWriteExtraTocPtr;/* Write extra TOC entry data
258258
* associated with the current archive
259259
* format */
260-
ReadExtraTocPtrReadExtraTocPtr;/* Read extr info associated with
260+
ReadExtraTocPtrTypeReadExtraTocPtr;/* Read extr info associated with
261261
* archie format */
262-
PrintExtraTocPtrPrintExtraTocPtr;/* Extra TOC info for format */
263-
PrintTocDataPtrPrintTocDataPtr;
262+
PrintExtraTocPtrTypePrintExtraTocPtr;/* Extra TOC info for format */
263+
PrintTocDataPtrTypePrintTocDataPtr;
264264

265-
StartBlobsPtrStartBlobsPtr;
266-
EndBlobsPtrEndBlobsPtr;
267-
StartBlobPtrStartBlobPtr;
268-
EndBlobPtrEndBlobPtr;
265+
StartBlobsPtrTypeStartBlobsPtr;
266+
EndBlobsPtrTypeEndBlobsPtr;
267+
StartBlobPtrTypeStartBlobPtr;
268+
EndBlobPtrTypeEndBlobPtr;
269269

270-
SetupWorkerPtrSetupWorkerPtr;
271-
WorkerJobDumpPtrWorkerJobDumpPtr;
272-
WorkerJobRestorePtrWorkerJobRestorePtr;
270+
SetupWorkerPtrTypeSetupWorkerPtr;
271+
WorkerJobDumpPtrTypeWorkerJobDumpPtr;
272+
WorkerJobRestorePtrTypeWorkerJobRestorePtr;
273273

274-
ClonePtrClonePtr;/* Clone format-specific fields */
275-
DeClonePtrDeClonePtr;/* Clean up cloned fields */
274+
ClonePtrTypeClonePtr;/* Clone format-specific fields */
275+
DeClonePtrTypeDeClonePtr;/* Clean up cloned fields */
276276

277-
CustomOutPtrCustomOutPtr;/* Alternative script output routine */
277+
CustomOutPtrTypeCustomOutPtr;/* Alternative script output routine */
278278

279279
/* Stuff for direct DB connection */
280280
char*archdbname;/* DB name *read* from archive */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp