mirror of
https://github.com/postgres/postgres.git
synced 2025-08-27 07:42:10 +03:00
Fix portability breakage in pg_dump.
Commit 0eea8047bf
introduced some overly
optimistic assumptions about what could be in a local struct variable's
initializer. (This might in fact be valid code according to C99, but I've
got at least one pre-C99 compiler that falls over on those nonconstant
address expressions.) There is no reason whatsoever for main()'s workspace
to not be static, so revert long_options[] to a static and make the
DumpOptions struct static as well.
This commit is contained in:
@@ -109,23 +109,27 @@ static void mark_create_done(ArchiveHandle *AH, TocEntry *te);
|
||||
static void inhibit_data_for_failed_table(ArchiveHandle *AH, TocEntry *te);
|
||||
|
||||
/*
|
||||
* Allocate a new DumpOptions block.
|
||||
* This is mainly so we can initialize it, but also for future expansion.
|
||||
* We pg_malloc0 the structure, so we don't need to initialize whatever is
|
||||
* 0, NULL or false anyway.
|
||||
* Allocate a new DumpOptions block containing all default values.
|
||||
*/
|
||||
DumpOptions *
|
||||
NewDumpOptions(void)
|
||||
{
|
||||
DumpOptions *opts;
|
||||
DumpOptions *opts = (DumpOptions *) pg_malloc(sizeof(DumpOptions));
|
||||
|
||||
opts = (DumpOptions *) pg_malloc0(sizeof(DumpOptions));
|
||||
InitDumpOptions(opts);
|
||||
return opts;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize a DumpOptions struct to all default values
|
||||
*/
|
||||
void
|
||||
InitDumpOptions(DumpOptions *opts)
|
||||
{
|
||||
memset(opts, 0, sizeof(DumpOptions));
|
||||
/* set any fields that shouldn't default to zeroes */
|
||||
opts->include_everything = true;
|
||||
opts->dumpSections = DUMP_UNSECTIONED;
|
||||
|
||||
return opts;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user