pgsql: Rename libpq trace internal functions

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Rename libpq trace internal functions
Date: 2024-05-02 14:48:29
Message-ID: E1s2XjY-0019Z3-66@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Rename libpq trace internal functions

libpq's pqTraceOutputMessage() used to look like this:

case 'Z': /* Ready For Query */
pqTraceOutputZ(conn->Pfdebug, message, &logCursor);
break;

Commit f4b54e1ed98 introduced macros for protocol characters, so now
it looks like this:

case PqMsg_ReadyForQuery:
pqTraceOutputZ(conn->Pfdebug, message, &logCursor);
break;

But this introduced a disconnect between the symbol in the switch case
and the function name to be called, so this made the manageability of
this file a bit worse.

This patch changes the function names to match, so now it looks like
this:

case PqMsg_ReadyForQuery:
pqTraceOutput_ReadyForQuery(conn->Pfdebug, message, &logCursor);
break;

(This also improves the readability of the file in general, since some
function names like "pqTraceOutputt" were a little hard to read
accurately.)

Some protocol characters have different meanings to and from the
server. The old code structure had a common function for both, for
example, pqTraceOutputD(). The new structure splits this up into
separate ones to match the protocol message name, like
pqTraceOutput_Describe() and pqTraceOutput_DataRow().

Reviewed-by: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
Discussion: https://www.postgresql.org/message-id/flat/575e4f9d-acfe-45e3-b7f1-7e32c579090e%40eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/42510c031b070228bfa024f6a4365dffd60086de

Modified Files
--------------
src/interfaces/libpq/fe-trace.c | 208 +++++++++++++++++++---------------------
1 file changed, 100 insertions(+), 108 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2024-05-02 15:28:35 pgsql: Disallow direct change of NO INHERIT of not-null constraints
Previous Message Heikki Linnakangas 2024-05-02 10:30:09 Re: pgsql: Fix compilation on OpenSSL 1.0.2 and LibreSSL