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 1nxWTy-0005j7-10 for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Jun 2022 16:18:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nxWTw-0006Re-78 for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Jun 2022 16:18:32 +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 1nxWTv-0006RV-AC for pgsql-hackers@lists.postgresql.org; Sat, 04 Jun 2022 16:18:31 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nxWTs-0001Hs-4A for pgsql-hackers@lists.postgresql.org; Sat, 04 Jun 2022 16:18:30 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A75D25C00FC; Sat, 4 Jun 2022 12:18:25 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sat, 04 Jun 2022 12:18:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1654359505; x=1654445905; bh=i jc5b9t3VfZJzhX7skI/aEOCGXIdS0BL6YdrO3yGjB8=; b=GUZWpgjazy72K7sXW vxtS2kXvnGVZb9zal/vIT37WyX872aXRnpTyOQtRSN/JtEyhH3xMwLiW74lOxVFO oLYpIy1qCYHUF3Ym4XEw3+MoErfsbMt7IWLPBy87J+fcenLqA18h6Ws4vxhYOf6+ UlGFcsthuBSpio6nQmIZVJNXQkAsAAB+6CE6vzxW1vshhm8NZl2U6eIqMwtn+kEt XpWlgnhSyb/S1VhLB9+FRh44eoXybNeweNxJYvlezRmUnDDLTiOuK5W8Z6WuWwJB 6NwfszV9B7lGpYK/T8UJ7vWpg2oUrf3UU//uSL38iE8gkOIdNDyRX3MHCYyl8B03 kfS9A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrleekgddutddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvvefukfggtggugfgjsehtke ertddttdejnecuhfhrohhmpeetlhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhr vgesrghlvhhhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpedtgfevueegge fhkedvieduhefgveehjeeijeevveeuiedvffdufeethedvtddtieenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvh hhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 4 Jun 2022 12:18:25 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 886E62A0803; Sat, 4 Jun 2022 18:18:20 +0200 (CEST) Date: Sat, 4 Jun 2022 18:18:20 +0200 From: Alvaro Herrera To: Tom Lane Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Count output lines automatically in psql/help.c Message-ID: <202206041618.2serkebdcmrz@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <365160.1654289490@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022-Jun-03, Tom Lane wrote: > So, attached is a patch to remove that maintenance chore by > constructing the output in a PQExpBuffer and then counting the > lines automatically. While I was at it, I introduced a couple of > macros to make the code shorter rather than longer. What about adding stringInfoCountLines or something like that? -- Álvaro Herrera