diff options
author | Bruce Momjian <bruce@momjian.us> | 2011-11-29 16:34:45 -0500 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2011-11-29 16:34:45 -0500 |
commit | 8b08deb0d1ee04a82130e640e48e302a3456817a (patch) | |
tree | 408b6fb90a1bb00ade40bf715315238dbc0e9eca /src/bin/pg_dump/pg_backup_archiver.c | |
parent | b60f37bf44c248189ed8e4d925cd8e45308d54f8 (diff) | |
download | postgresql-8b08deb0d1ee04a82130e640e48e302a3456817a.tar.gz postgresql-8b08deb0d1ee04a82130e640e48e302a3456817a.zip |
Simplify the pg_dump/pg_restore error reporting macros, and allow
pg_dumpall to use the same memory allocation functions as the others.
Diffstat (limited to 'src/bin/pg_dump/pg_backup_archiver.c')
-rw-r--r-- | src/bin/pg_dump/pg_backup_archiver.c | 41 |
1 files changed, 3 insertions, 38 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index 164d593ff9e..1eb2b8b40e8 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -84,8 +84,6 @@ typedef struct _outputContext int gzOut; } OutputContext; -const char *progname; - static const char *modulename = gettext_noop("archiver"); /* index array created by fix_dependencies -- only used in parallel restore */ @@ -120,7 +118,6 @@ static int _discoverArchiveFormat(ArchiveHandle *AH); static int RestoringToDB(ArchiveHandle *AH); static void dump_lo_buf(ArchiveHandle *AH); -static void _write_msg(const char *modulename, const char *fmt, va_list ap) __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 0))); static void _die_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt, va_list ap) __attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 0))); static void dumpTimestamp(ArchiveHandle *AH, const char *msg, time_t tim); @@ -1302,7 +1299,7 @@ ahlog(ArchiveHandle *AH, int level, const char *fmt,...) return; va_start(ap, fmt); - _write_msg(NULL, fmt, ap); + write_msg(NULL, fmt, ap); va_end(ap); } @@ -1420,32 +1417,11 @@ ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH) } } -/* Common exit code */ -static void -_write_msg(const char *modulename, const char *fmt, va_list ap) -{ - if (modulename) - fprintf(stderr, "%s: [%s] ", progname, _(modulename)); - else - fprintf(stderr, "%s: ", progname); - vfprintf(stderr, _(fmt), ap); -} - -void -write_msg(const char *modulename, const char *fmt,...) -{ - va_list ap; - - va_start(ap, fmt); - _write_msg(modulename, fmt, ap); - va_end(ap); -} - static void _die_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt, va_list ap) { - _write_msg(modulename, fmt, ap); + write_msg(modulename, fmt, ap); if (AH) { @@ -1458,17 +1434,6 @@ _die_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt, va_lis exit(1); } -/* External use */ -void -exit_horribly(Archive *AH, const char *modulename, const char *fmt,...) -{ - va_list ap; - - va_start(ap, fmt); - _die_horribly((ArchiveHandle *) AH, modulename, fmt, ap); - va_end(ap); -} - /* Archiver use (just different arg declaration) */ void die_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt,...) @@ -1524,7 +1489,7 @@ warn_or_die_horribly(ArchiveHandle *AH, _die_horribly(AH, modulename, fmt, ap); else { - _write_msg(modulename, fmt, ap); + write_msg(modulename, fmt, ap); AH->public.n_errors++; } va_end(ap); |