Re: pgsql: Add missing string terminator - Mailing list pgsql-committers

From Daniel Gustafsson
Subject Re: pgsql: Add missing string terminator
Date
Msg-id F945C717-A609-4EAA-A412-C267B11ACEF2@yesql.se
Whole thread Raw
In response to Re: pgsql: Add missing string terminator  (David Rowley <dgrowleyml@gmail.com>)
List pgsql-committers
> 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




pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Update time zone data files to tzdata release 2025b.
Next
From: Nathan Bossart
Date:
Subject: pgsql: doc: Alphabetize long options for pg_dump[all].