Rename libpq trace internal functions - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Rename libpq trace internal functions
Date
Msg-id 575e4f9d-acfe-45e3-b7f1-7e32c579090e@eisentraut.org
Whole thread Raw
Responses Re: Rename libpq trace internal functions
List pgsql-hackers
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().
Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Cleanup: remove unused fields from nodes
Next
From: Heikki Linnakangas
Date:
Subject: Re: Feature request: schema diff tool