From 0873b2d354b9c73a69067c0afb92e35994adc47e Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 15 Nov 2022 11:50:04 +0100 Subject: libpq error message refactoring libpq now contains a mix of error message strings that end with newlines and don't end with newlines, due to some newer code paths with new ways of passing errors around. This leads to confusion and mistakes both during development and translation. This adds new functions libpq_append_error() and libpq_append_conn_error() that encapsulate common code paths for producing error message strings. Notably, these functions append the newline, so that the string appearing in the code does not end with a newline. This makes (almost) all error message strings in libpq uniform in this regard (and also consistent with how we handle it outside of libpq code). (There are a few exceptions that are difficult to fit into this scheme, but they are only a few.) Reviewed-by: Alvaro Herrera Discussion: https://www.postgresql.org/message-id/flat/7c0232ef-7b44-68db-599d-b327d0640a77@enterprisedb.com --- src/interfaces/libpq/pqexpbuffer.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/interfaces/libpq/pqexpbuffer.c') diff --git a/src/interfaces/libpq/pqexpbuffer.c b/src/interfaces/libpq/pqexpbuffer.c index eb51e6d0884..10b32efdfeb 100644 --- a/src/interfaces/libpq/pqexpbuffer.c +++ b/src/interfaces/libpq/pqexpbuffer.c @@ -40,8 +40,6 @@ static const char oom_buffer[1] = ""; /* Need a char * for unconstify() compatibility */ static const char *oom_buffer_ptr = oom_buffer; -static bool appendPQExpBufferVA(PQExpBuffer str, const char *fmt, va_list args) pg_attribute_printf(2, 0); - /* * markPQExpBufferBroken @@ -292,7 +290,7 @@ appendPQExpBuffer(PQExpBuffer str, const char *fmt,...) * Caution: callers must be sure to preserve their entry-time errno * when looping, in case the fmt contains "%m". */ -static bool +bool appendPQExpBufferVA(PQExpBuffer str, const char *fmt, va_list args) { size_t avail; -- cgit v1.2.3