diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-01-13 17:48:33 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-01-13 17:48:33 -0500 |
commit | 5b5fea2a11741e651f7c25e981dd29b610a08426 (patch) | |
tree | a1c894f26ca809c8e9a6b10a9c974d641a0b2c40 /src/bin/pg_dump/pg_backup_custom.c | |
parent | 26905e009babe6020fddcf3820e57e2f87c5539c (diff) | |
download | postgresql-5b5fea2a11741e651f7c25e981dd29b610a08426.tar.gz postgresql-5b5fea2a11741e651f7c25e981dd29b610a08426.zip |
Access pg_dump's options structs through Archive struct, not directly.
Rather than passing around DumpOptions and RestoreOptions as separate
arguments, add fields to struct Archive to carry pointers to these objects,
and access them through those fields when needed. There already was a
RestoreOptions pointer in Archive, though for no obvious reason it was part
of the "private" struct rather than out where pg_dump.c could see it.
Doing this allows reversion of quite a lot of parameter-addition changes
made in commit 0eea8047bf, which is a good thing IMO because this will
reduce the code delta between 9.4 and 9.5, probably easing a few future
back-patch efforts. Moreover, the previous commit only added a DumpOptions
argument to functions that had to have it at the time, which means we could
anticipate still more code churn (and more back-patch hazard) as the
requirement spread further. I'd hit exactly that problem in my upcoming
patch to fix extension membership marking, which is what motivated me to
do this.
Diffstat (limited to 'src/bin/pg_dump/pg_backup_custom.c')
-rw-r--r-- | src/bin/pg_dump/pg_backup_custom.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/bin/pg_dump/pg_backup_custom.c b/src/bin/pg_dump/pg_backup_custom.c index ee05380502c..be6dbca0566 100644 --- a/src/bin/pg_dump/pg_backup_custom.c +++ b/src/bin/pg_dump/pg_backup_custom.c @@ -42,9 +42,9 @@ static int _WriteByte(ArchiveHandle *AH, const int i); static int _ReadByte(ArchiveHandle *); static void _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len); static void _ReadBuf(ArchiveHandle *AH, void *buf, size_t len); -static void _CloseArchive(ArchiveHandle *AH, DumpOptions *dopt); +static void _CloseArchive(ArchiveHandle *AH); static void _ReopenArchive(ArchiveHandle *AH); -static void _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt); +static void _PrintTocData(ArchiveHandle *AH, TocEntry *te); static void _WriteExtraToc(ArchiveHandle *AH, TocEntry *te); static void _ReadExtraToc(ArchiveHandle *AH, TocEntry *te); static void _PrintExtraToc(ArchiveHandle *AH, TocEntry *te); @@ -419,7 +419,7 @@ _EndBlobs(ArchiveHandle *AH, TocEntry *te) * Print data for a given TOC entry */ static void -_PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt) +_PrintTocData(ArchiveHandle *AH, TocEntry *te) { lclContext *ctx = (lclContext *) AH->formatData; lclTocEntry *tctx = (lclTocEntry *) te->formatData; @@ -500,7 +500,7 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt) break; case BLK_BLOBS: - _LoadBlobs(AH, ropt->dropSchema); + _LoadBlobs(AH, AH->public.ropt->dropSchema); break; default: /* Always have a default */ @@ -695,7 +695,7 @@ _ReadBuf(ArchiveHandle *AH, void *buf, size_t len) * */ static void -_CloseArchive(ArchiveHandle *AH, DumpOptions *dopt) +_CloseArchive(ArchiveHandle *AH) { lclContext *ctx = (lclContext *) AH->formatData; pgoff_t tpos; @@ -710,7 +710,7 @@ _CloseArchive(ArchiveHandle *AH, DumpOptions *dopt) strerror(errno)); WriteToc(AH); ctx->dataStart = _getFilePos(AH, ctx); - WriteDataChunks(AH, dopt, NULL); + WriteDataChunks(AH, NULL); /* * If possible, re-write the TOC in order to update the data offset |