mirror of
https://github.com/postgres/postgres.git
synced 2025-06-29 10:41:53 +03:00
Clean up after recent pg_dump patches.
Fix entirely broken handling of va_list printing routines, update some out-of-date comments, fix some bogus inclusion orders, fix NLS declarations, fix missed realloc calls.
This commit is contained in:
@ -16,14 +16,14 @@
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "dumpmem.h"
|
||||
#include "dumputils.h"
|
||||
|
||||
#include "parser/keywords.h"
|
||||
|
||||
|
||||
/* Globals exported by this file */
|
||||
int quote_all_identifiers = 0;
|
||||
const char *progname;
|
||||
const char *progname = NULL;
|
||||
|
||||
|
||||
#define supports_grant_options(version) ((version) >= 70400)
|
||||
@ -1214,31 +1214,51 @@ emitShSecLabels(PGconn *conn, PGresult *res, PQExpBuffer buffer,
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Write a printf-style message to stderr.
|
||||
*
|
||||
* The program name is prepended, if "progname" has been set.
|
||||
* Also, if modulename isn't NULL, that's included too.
|
||||
* Note that we'll try to translate the modulename and the fmt string.
|
||||
*/
|
||||
void
|
||||
write_msg(const char *modulename, const char *fmt,...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
if (modulename)
|
||||
fprintf(stderr, "%s: [%s] ", progname, _(modulename));
|
||||
else
|
||||
fprintf(stderr, "%s: ", progname);
|
||||
vfprintf(stderr, _(fmt), ap);
|
||||
vwrite_msg(modulename, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/*
|
||||
* As write_msg, but pass a va_list not variable arguments.
|
||||
*/
|
||||
void
|
||||
vwrite_msg(const char *modulename, const char *fmt, va_list ap)
|
||||
{
|
||||
if (progname)
|
||||
{
|
||||
if (modulename)
|
||||
fprintf(stderr, "%s: [%s] ", progname, _(modulename));
|
||||
else
|
||||
fprintf(stderr, "%s: ", progname);
|
||||
}
|
||||
vfprintf(stderr, _(fmt), ap);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Fail and die, with a message to stderr. Parameters as for write_msg.
|
||||
*/
|
||||
void
|
||||
exit_horribly(const char *modulename, const char *fmt,...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
write_msg(modulename, fmt, ap);
|
||||
vwrite_msg(modulename, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user