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 1uA9R1-00BOwa-PZ for pgsql-committers@arkaria.postgresql.org; Wed, 30 Apr 2025 15:33:20 +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 1uA9Qz-00EikI-IU for pgsql-committers@arkaria.postgresql.org; Wed, 30 Apr 2025 15:33:18 +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 1uA9Qz-00EikA-7P for pgsql-committers@lists.postgresql.org; Wed, 30 Apr 2025 15:33:18 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uA9Qx-000N0l-0K for pgsql-committers@lists.postgresql.org; Wed, 30 Apr 2025 15:33:17 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id D7A623731DC for ; Wed, 30 Apr 2025 17:33:11 +0200 (CEST) Received: from s899.loopia.se (unknown [172.22.191.5]) by s807.loopia.se (Postfix) with ESMTP id C93EA37325C; Wed, 30 Apr 2025 17:33:11 +0200 (CEST) Received: from s473.loopia.se (unknown [172.22.191.5]) by s899.loopia.se (Postfix) with ESMTP id C5F7C2C8BA8D; Wed, 30 Apr 2025 17:33:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1.2 X-Spam-Level: X-Spam-Status: No, score=-1.2 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1] autolearn=disabled Authentication-Results: s473.loopia.se (amavisd-new); dkim=pass (2048-bit key) header.d=yesql.se Received: from s981.loopia.se ([172.22.191.6]) by s473.loopia.se (s473.loopia.se [172.22.190.13]) (amavisd-new, port 10024) with UTF8LMTP id thi7HV6FuBQO; Wed, 30 Apr 2025 17:33:11 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.193 Received: from smtpclient.apple (customer-89-255-232-193.stosn.net [89.255.232.193]) (Authenticated sender: daniel@yesql.se) by s981.loopia.se (Postfix) with ESMTPSA id 30B6922B1792; Wed, 30 Apr 2025 17:33:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yesql.se; s=loopiadkim1707475645; t=1746027191; bh=qAq/v3rvF0xaNkJNI7EsFodAQlwAWaDmHj6jlvPZ/Zc=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=MiQQLQN1vD2VEGeZ7//SJlCg39Glpl+TTccx5ncw6dOqGiXlEBJTsPZZdmhyTefJA H5TjN9jubIIbcILapBjgnniel8ygH9rPiYvJDMjjTDlCRoRBstReux2kT2oJRV36Kr FaP6n/BhM7EPW8J/oBR/EdZgVWj31QyFea/9jYf+gim5QH8+b47jKoLNBvYJAbLvj9 jakSQoSMIIrgwtXgmq40oiTLiJ1zLhP1gpBj2RjiB930qVgfNMSGUpvRCsydz7UexB 2dLhpSxzYURCU78tz7nX1tpwcEq8h3BBBsD8vfxJDRX/ToN5isvFdpNS/sTP3b92SR x5EypNL0ccsMA== Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51.11.1\)) Subject: Re: pgsql: Add missing string terminator From: Daniel Gustafsson In-Reply-To: Date: Wed, 30 Apr 2025 17:33:00 +0200 Cc: Peter Eisentraut , pgsql-committers@lists.postgresql.org Content-Transfer-Encoding: 7bit Message-Id: References: <9887D3A8-A74F-4836-BC57-74AC4AE901BB@yesql.se> <0755ae22-4e04-4c69-b344-8c4db54d6e23@eisentraut.org> To: David Rowley X-Mailer: Apple Mail (2.3776.700.51.11.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 30 Apr 2025, at 15:14, David Rowley wrote: > On Thu, 1 May 2025 at 00:44, Peter Eisentraut wrote: >> I think it's best in general to use str* for strings and mem* for >> not-strings. That's easier to read and also better for static analyzers >> etc. > > The reason I think memcpy is better is that the NUL only needs to be > found once. memcpy() is much faster than strlcpy() because it can > operate on many bytes at once rather than doing 1 byte at a time. I don't disagree, but since similar codepaths in this file use strlcpy now I will opt for that for consistency (and thus readability) with a TODO item to look at changing all these for memcpy during v19. -- Daniel Gustafsson