Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nxX5K-0007KW-Dl for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Jun 2022 16:57:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nxX5J-0007FM-8X for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Jun 2022 16:57:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nxX5I-00079j-V9 for pgsql-hackers@lists.postgresql.org; Sat, 04 Jun 2022 16:57:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nxX5E-0001g2-Iz for pgsql-hackers@lists.postgresql.org; Sat, 04 Jun 2022 16:57:05 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 254Gux3t573744; Sat, 4 Jun 2022 12:57:00 -0400 From: Tom Lane To: Alvaro Herrera cc: pgsql-hackers@lists.postgresql.org Subject: Re: Count output lines automatically in psql/help.c In-reply-to: <202206041618.2serkebdcmrz@alvherre.pgsql> References: <202206041618.2serkebdcmrz@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Sat, 04 Jun 2022 18:18:20 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <573742.1654361819.1@sss.pgh.pa.us> Date: Sat, 04 Jun 2022 12:56:59 -0400 Message-ID: <573743.1654361819@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alvaro Herrera writes: > What about adding stringInfoCountLines or something like that? If we have other use-cases, maybe that'd be worthwhile. (In the committed patch, I dumbed it down to a plain per-char loop without the strchr() complication. So it's very little code. I'm not real sure that strchr would make it faster.) regards, tom lane