Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rzZxN-0050az-DZ for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Apr 2024 10:34:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rzZxL-00E8dO-Sv for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Apr 2024 10:34:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rzZxL-00E8Z5-IS for pgsql-hackers@lists.postgresql.org; Wed, 24 Apr 2024 10:34:27 +0000 Received: from ml.sraoss.co.jp ([66.11.59.17]) by makus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rzZxI-004Ow0-F7 for pgsql-hackers@postgresql.org; Wed, 24 Apr 2024 10:34:25 +0000 Received: from sranhm.sraoss.co.jp (unknown [192.168.174.164]) by osspc26.sraoss.co.jp (Postfix) with ESMTP id B71682F00090; Wed, 24 Apr 2024 19:34:22 +0900 (JST) Received: from yugon-CFSV7-1 (dhcp-175-106.sraoss.co.jp [192.168.175.106]) by sranhm.sraoss.co.jp (Postfix) with SMTP id 880D034177E; Wed, 24 Apr 2024 19:34:22 +0900 (JST) Date: Wed, 24 Apr 2024 19:34:22 +0900 From: Yugo NAGATA To: Peter Eisentraut Cc: pgsql-hackers Subject: Re: Rename libpq trace internal functions Message-Id: <20240424193422.ef3ea25136e665448852a8fa@sraoss.co.jp> In-Reply-To: <575e4f9d-acfe-45e3-b7f1-7e32c579090e@eisentraut.org> References: <575e4f9d-acfe-45e3-b7f1-7e32c579090e@eisentraut.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 24 Apr 2024 09:39:02 +0200 Peter Eisentraut wrote: > 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; +1 I prefer the new function names since it seems more natural and easier to read. I noticed pqTraceOutputNR() is left as is, is this intentional? Or, shoud this be changed to pqTranceOutput_NoticeResponse()? Regards, Yugo Nagata > (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(). -- Yugo NAGATA