Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/pg_journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,29 @@ append_fmt(StringInfo str, struct iovec *field, const char *fmt, ...)
{
size_t old_len = str->len;
va_list args;
#if PG_VERSION_NUM >= 90400
int needed;
#else
bool success;
#endif

/* appendStringInfoVA can fail due to insufficient space */
while (1) {
va_start(args, fmt);
#if PG_VERSION_NUM >= 90400
needed = appendStringInfoVA(str, fmt, args);
#else
success = appendStringInfoVA(str, fmt, args);
#endif
va_end(args);

#if PG_VERSION_NUM >= 90400
if (needed == 0)
break;
#else
if (success)
break;
#endif

/* Double the buffer size and try again. */
enlargeStringInfo(str, str->maxlen);
Expand Down