Re: Replace remaining StrNCpy() by strlcpy() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Replace remaining StrNCpy() by strlcpy()
Date
Msg-id 2850241.1596902962@sss.pgh.pa.us
Whole thread Raw
In response to Re: Replace remaining StrNCpy() by strlcpy()  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: Replace remaining StrNCpy() by strlcpy()  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
Peter Eisentraut <peter.eisentraut@2ndquadrant.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.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: get rid of distprep?
Next
From: Alvaro Herrera
Date:
Subject: Re: walsender waiting_for_ping spuriously set