Re: Replace remaining StrNCpy() by strlcpy()

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Replace remaining StrNCpy() by strlcpy()
Date: 2020-08-10 23:23:15
Message-ID: 73b33b41-d445-8073-978e-b69c91b5da52@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020-08-08 18:09, Tom Lane wrote:
> Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> writes:
>> I removed namecpy() altogether because you can just use struct assignment.
>
> Makes sense, and I notice it was unused anyway.
>
> v3 passes eyeball examination (I didn't bother running tests), with
> only one remaining nit: the proposed commit message says
>
> They are equivalent,
>
> which per this thread is incorrect. Somebody might possibly refer to this
> commit for guidance in updating third-party code, so I don't think we want
> to leave a misleading claim here. Perhaps something like
>
> They are equivalent, except that StrNCpy zero-fills the entire
> destination buffer instead of providing just one trailing zero.
> For all but a tiny number of callers, that's just overhead rather
> than being desirable.

Committed with that change.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2020-08-10 23:38:15 remove spurious CREATE INDEX CONCURRENTLY wait
Previous Message Alvaro Herrera 2020-08-10 22:56:37 massive FPI_FOR_HINT load after promote