Re: Replace remaining StrNCpy() by strlcpy()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Replace remaining StrNCpy() by strlcpy()
Дата
Msg-id 2850241.1596902962@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Replace remaining StrNCpy() by strlcpy()  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Ответы Re: Replace remaining StrNCpy() by strlcpy()  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: get rid of distprep?
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: walsender waiting_for_ping spuriously set