Use the right appendStringInfoVA interface
pgut version renamed to avoid confusion with the server version. (I wonder why there is such a duplication of interfaces and implementations there though...)
This commit is contained in:
parent
5e47c4c9c0
commit
564f061beb
@ -840,7 +840,7 @@ elog(int elevel, const char *fmt, ...)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
ok = appendStringInfoVA(&edata->msg, fmt, args);
|
ok = pgut_appendStringInfoVA(&edata->msg, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
} while (!ok);
|
} while (!ok);
|
||||||
len = strlen(fmt);
|
len = strlen(fmt);
|
||||||
@ -1005,7 +1005,7 @@ errmsg(const char *fmt,...)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
ok = appendStringInfoVA(&edata->msg, fmt, args);
|
ok = pgut_appendStringInfoVA(&edata->msg, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
} while (!ok);
|
} while (!ok);
|
||||||
len = strlen(fmt);
|
len = strlen(fmt);
|
||||||
@ -1026,7 +1026,7 @@ errdetail(const char *fmt,...)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
ok = appendStringInfoVA(&edata->detail, fmt, args);
|
ok = pgut_appendStringInfoVA(&edata->detail, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
} while (!ok);
|
} while (!ok);
|
||||||
trimStringBuffer(&edata->detail);
|
trimStringBuffer(&edata->detail);
|
||||||
@ -1212,7 +1212,7 @@ exit_or_abort(int exitcode)
|
|||||||
* unlike the server code, this function automatically extend the buffer.
|
* unlike the server code, this function automatically extend the buffer.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
|
pgut_appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
size_t avail;
|
size_t avail;
|
||||||
int nprinted;
|
int nprinted;
|
||||||
|
@ -150,7 +150,7 @@ extern void CHECK_FOR_INTERRUPTS(void);
|
|||||||
#define appendStringInfoChar appendPQExpBufferChar
|
#define appendStringInfoChar appendPQExpBufferChar
|
||||||
#define appendBinaryStringInfo appendBinaryPQExpBuffer
|
#define appendBinaryStringInfo appendBinaryPQExpBuffer
|
||||||
|
|
||||||
extern bool appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
|
extern bool pgut_appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
|
||||||
__attribute__((format(printf, 2, 0)));
|
__attribute__((format(printf, 2, 0)));
|
||||||
extern int appendStringInfoFile(StringInfo str, FILE *fp);
|
extern int appendStringInfoFile(StringInfo str, FILE *fp);
|
||||||
extern int appendStringInfoFd(StringInfo str, int fd);
|
extern int appendStringInfoFd(StringInfo str, int fd);
|
||||||
|
@ -29,11 +29,20 @@ termStringInfo(StringInfo str)
|
|||||||
static void
|
static void
|
||||||
appendStringInfoVA_s(StringInfo str, const char *fmt, va_list args)
|
appendStringInfoVA_s(StringInfo str, const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
|
#if PG_VERSION_NUM >= 90400
|
||||||
|
int needed;
|
||||||
|
while ((needed = appendStringInfoVA(str, fmt, args)) > 0)
|
||||||
|
{
|
||||||
|
/* Double the buffer size and try again. */
|
||||||
|
enlargeStringInfo(str, needed);
|
||||||
|
}
|
||||||
|
#else
|
||||||
while (!appendStringInfoVA(str, fmt, args))
|
while (!appendStringInfoVA(str, fmt, args))
|
||||||
{
|
{
|
||||||
/* Double the buffer size and try again. */
|
/* Double the buffer size and try again. */
|
||||||
enlargeStringInfo(str, str->maxlen);
|
enlargeStringInfo(str, str->maxlen);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* simple execute */
|
/* simple execute */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user