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

Commitd2a2808

Browse files
committed
pg_dump: Don't use enums for defining bit mask values
This usage would mean that values of the enum type are potentially notone of the enum values. Use macros instead, like everywhere else.Discussion:https://www.postgresql.org/message-id/14dde730-1d34-260e-fa9d-7664df2d6313@enterprisedb.com
1 parent525e60b commitd2a2808

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static void _selectTableAccessMethod(ArchiveHandle *AH, const char *tableam);
8686
staticvoidprocessEncodingEntry(ArchiveHandle*AH,TocEntry*te);
8787
staticvoidprocessStdStringsEntry(ArchiveHandle*AH,TocEntry*te);
8888
staticvoidprocessSearchPathEntry(ArchiveHandle*AH,TocEntry*te);
89-
staticteReqs_tocEntryRequired(TocEntry*te,teSectioncurSection,ArchiveHandle*AH);
89+
staticint_tocEntryRequired(TocEntry*te,teSectioncurSection,ArchiveHandle*AH);
9090
staticRestorePass_tocEntryRestorePass(TocEntry*te);
9191
staticbool_tocEntryIsACL(TocEntry*te);
9292
staticvoid_disableTriggersIfNecessary(ArchiveHandle*AH,TocEntry*te);
@@ -757,7 +757,7 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, bool is_parallel)
757757
{
758758
RestoreOptions*ropt=AH->public.ropt;
759759
intstatus=WORKER_OK;
760-
teReqsreqs;
760+
intreqs;
761761
booldefnDumped;
762762

763763
AH->currentTE=te;
@@ -1868,7 +1868,7 @@ getTocEntryByDumpId(ArchiveHandle *AH, DumpId id)
18681868
returnNULL;
18691869
}
18701870

1871-
teReqs
1871+
int
18721872
TocIDRequired(ArchiveHandle*AH,DumpIdid)
18731873
{
18741874
TocEntry*te=getTocEntryByDumpId(AH,id);
@@ -2803,10 +2803,10 @@ StrictNamesCheck(RestoreOptions *ropt)
28032803
* REQ_SCHEMA and REQ_DATA bits if we want to restore schema and/or data
28042804
* portions of this TOC entry, or REQ_SPECIAL if it's a special entry.
28052805
*/
2806-
staticteReqs
2806+
staticint
28072807
_tocEntryRequired(TocEntry*te,teSectioncurSection,ArchiveHandle*AH)
28082808
{
2809-
teReqsres=REQ_SCHEMA |REQ_DATA;
2809+
intres=REQ_SCHEMA |REQ_DATA;
28102810
RestoreOptions*ropt=AH->public.ropt;
28112811

28122812
/* These items are treated specially */

‎src/bin/pg_dump/pg_backup_archiver.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,9 @@ typedef enum
229229
#defineRESTORE_PASS_LASTRESTORE_PASS_POST_ACL
230230
}RestorePass;
231231

232-
typedefenum
233-
{
234-
REQ_SCHEMA=0x01,/* want schema */
235-
REQ_DATA=0x02,/* want data */
236-
REQ_SPECIAL=0x04/* for special TOC entries */
237-
}teReqs;
232+
#defineREQ_SCHEMA0x01/* want schema */
233+
#defineREQ_DATA0x02/* want data */
234+
#defineREQ_SPECIAL0x04/* for special TOC entries */
238235

239236
struct_archiveHandle
240237
{
@@ -386,7 +383,7 @@ struct _tocEntry
386383

387384
/* working state while dumping/restoring */
388385
pgoff_tdataLength;/* item's data size; 0 if none or unknown */
389-
teReqsreqs;/* do we need schema and/or data of object */
386+
intreqs;/* do we need schema and/or data of object (REQ_* bit mask) */
390387
boolcreated;/* set for DATA member if TABLE was created */
391388

392389
/* working state (needed only for parallel restore) */
@@ -436,7 +433,7 @@ extern void WriteDataChunksForTocEntry(ArchiveHandle *AH, TocEntry *te);
436433
externArchiveHandle*CloneArchive(ArchiveHandle*AH);
437434
externvoidDeCloneArchive(ArchiveHandle*AH);
438435

439-
externteReqsTocIDRequired(ArchiveHandle*AH,DumpIdid);
436+
externintTocIDRequired(ArchiveHandle*AH,DumpIdid);
440437
TocEntry*getTocEntryByDumpId(ArchiveHandle*AH,DumpIdid);
441438
externboolcheckSeek(FILE*fp);
442439

‎src/bin/pg_dump/pg_backup_utils.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@
1717

1818
#include"common/logging.h"
1919

20-
typedefenum/* bits returned by set_dump_section */
21-
{
22-
DUMP_PRE_DATA=0x01,
23-
DUMP_DATA=0x02,
24-
DUMP_POST_DATA=0x04,
25-
DUMP_UNSECTIONED=0xff
26-
}DumpSections;
20+
/* bits returned by set_dump_section */
21+
#defineDUMP_PRE_DATA0x01
22+
#defineDUMP_DATA0x02
23+
#defineDUMP_POST_DATA0x04
24+
#defineDUMP_UNSECTIONED0xff
2725

2826
typedefvoid (*on_exit_nicely_callback) (intcode,void*arg);
2927

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp