pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Gustafsson <daniel@yesql.se>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Peter Eisentraut <peter@eisentraut.org>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Add missing string terminator
Date: Wed, 30 Apr 2025 17:33:00 +0200
Message-ID: <F945C717-A609-4EAA-A412-C267B11ACEF2@yesql.se> (raw)
In-Reply-To: <CAApHDvpjjHS=1zjuh3F=uE10gwn_mapPv5JPgQu1Z4-8H949=w@mail.gmail.com>
References: <E1uA3rI-000Ibx-19@gemulon.postgresql.org>
	<CAApHDvrg3Gz6kF76Feyc6Dyi9u7iS+vcdQw3VZgGA1+wUc=wRQ@mail.gmail.com>
	<9887D3A8-A74F-4836-BC57-74AC4AE901BB@yesql.se>
	<CAApHDvrEJeCPesmpeS24UAU8vanq9vKYZC6m1kTDFkxQQ2qTiw@mail.gmail.com>
	<CAApHDvoRKSrujq5FN8WzncVtTpVL2c_LMs-o=8fjdmqce1pmjQ@mail.gmail.com>
	<0755ae22-4e04-4c69-b344-8c4db54d6e23@eisentraut.org>
	<CAApHDvpjjHS=1zjuh3F=uE10gwn_mapPv5JPgQu1Z4-8H949=w@mail.gmail.com>

> On 30 Apr 2025, at 15:14, David Rowley <dgrowleyml@gmail.com> wrote:
> On Thu, 1 May 2025 at 00:44, Peter Eisentraut <peter@eisentraut.org> 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






view thread (8+ messages)

Message-ID: <F945C717-A609-4EAA-A412-C267B11ACEF2@yesql.se>
Permalink:  ../F945C717-A609-4EAA-A412-C267B11ACEF2@yesql.se/
Also on:    postgresql.org/message-id/F945C717-A609-4EAA-A412-C267B11ACEF2@yesql.se

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: daniel@yesql.se, dgrowleyml@gmail.com, peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Add missing string terminator
  In-Reply-To: <F945C717-A609-4EAA-A412-C267B11ACEF2@yesql.se>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox