Re: Faster StrNCpy

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Faster StrNCpy
Дата
Msg-id 26197.1159458964@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Faster StrNCpy  ("Strong, David" <david.strong@unisys.com>)
Ответы Re: Faster StrNCpy  (Markus Schaber <schabi@logix-tt.com>)
Список pgsql-hackers
"Strong, David" <david.strong@unisys.com> writes:
> Just wondering - are any of these cases where a memcpy() would work
> just as well? Or are you not sure that the source string is at least
> 64 bytes in length?

In most cases, we're pretty sure that it's *not* --- it'll just be a
palloc'd C string.

I'm disinclined to fool with the restriction that namestrcpy zero-pad
Name values, because they might end up on disk, and allowing random
memory contents to get written out is ungood from a security point of
view.  However, it's entirely possible that it'd be a bit faster to do
a MemSet followed by strlcpy than to use strncpy for zero-padding.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Row IS NULL question
Следующее
От: Gevik Babakhani
Дата:
Сообщение: Re: Row IS NULL question