aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_dump/pg_backup_null.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-01-13 17:48:33 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2016-01-13 17:48:33 -0500
commit5b5fea2a11741e651f7c25e981dd29b610a08426 (patch)
treea1c894f26ca809c8e9a6b10a9c974d641a0b2c40 /src/bin/pg_dump/pg_backup_null.c
parent26905e009babe6020fddcf3820e57e2f87c5539c (diff)
downloadpostgresql-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_null.c')
-rw-r--r--src/bin/pg_dump/pg_backup_null.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/bin/pg_dump/pg_backup_null.c b/src/bin/pg_dump/pg_backup_null.c
index 77cf3fdc51a..848eed49d0d 100644
--- a/src/bin/pg_dump/pg_backup_null.c
+++ b/src/bin/pg_dump/pg_backup_null.c
@@ -33,8 +33,8 @@ static void _WriteBlobData(ArchiveHandle *AH, const void *data, size_t dLen);
static void _EndData(ArchiveHandle *AH, TocEntry *te);
static int _WriteByte(ArchiveHandle *AH, const int i);
static void _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len);
-static void _CloseArchive(ArchiveHandle *AH, DumpOptions *dopt);
-static void _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
+static void _CloseArchive(ArchiveHandle *AH);
+static void _PrintTocData(ArchiveHandle *AH, TocEntry *te);
static void _StartBlobs(ArchiveHandle *AH, TocEntry *te);
static void _StartBlob(ArchiveHandle *AH, TocEntry *te, Oid oid);
static void _EndBlob(ArchiveHandle *AH, TocEntry *te, Oid oid);
@@ -149,7 +149,7 @@ _StartBlob(ArchiveHandle *AH, TocEntry *te, Oid oid)
exit_horribly(NULL, "invalid OID for large object\n");
/* With an old archive we must do drop and create logic here */
- if (old_blob_style && AH->ropt->dropSchema)
+ if (old_blob_style && AH->public.ropt->dropSchema)
DropBlobIfExists(AH, oid);
if (old_blob_style)
@@ -192,20 +192,16 @@ _EndBlobs(ArchiveHandle *AH, TocEntry *te)
*------
*/
static void
-_PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
+_PrintTocData(ArchiveHandle *AH, TocEntry *te)
{
if (te->dataDumper)
{
- DumpOptions *dopt;
-
AH->currToc = te;
if (strcmp(te->desc, "BLOBS") == 0)
_StartBlobs(AH, te);
- dopt = dumpOptionsFromRestoreOptions(ropt);
- (*te->dataDumper) ((Archive *) AH, dopt, te->dataDumperArg);
- pg_free(dopt);
+ (*te->dataDumper) ((Archive *) AH, te->dataDumperArg);
if (strcmp(te->desc, "BLOBS") == 0)
_EndBlobs(AH, te);
@@ -229,7 +225,7 @@ _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len)
}
static void
-_CloseArchive(ArchiveHandle *AH, DumpOptions *dopt)
+_CloseArchive(ArchiveHandle *AH)
{
/* Nothing to do */
}