Re: pg_malloc0() instead of pg_malloc()+memset()

Поиск
Список
Период
Сортировка
От Daniel Gustafsson
Тема Re: pg_malloc0() instead of pg_malloc()+memset()
Дата
Msg-id Uw3w7SS-WJhjOpf3Q0uLVIhwaIntwW0huKXwOz2fYQhu-QK59oRtaFOhJLezUcYC7uhnwd0ja5MujX7FHLOQG3CUH-akiGRaxJJwCTngDNw=@yesql.se
обсуждение исходный текст
Ответ на Re: pg_malloc0() instead of pg_malloc()+memset()  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
On Tuesday, March 26, 2019 9:00 AM, Michael Paquier <michael@paquier.xyz> wrote:

> On Mon, Mar 25, 2019 at 01:18:05PM +0000, Daniel Gustafsson wrote:
>
> > When reading another codepath, I happened to notice a few codepaths where we do
> > pg_malloc() immediately followed by a memset( .. 0, ..), without there being a
> > justification (that I can see) for not using pg_malloc0() instead. The attached
> > patch changes to pg_malloc0(), and passes make check.
>
> If we simplify all of them (and that's not really a big deal), I have
> spotted two extra places on top of what you noticed, one in gist.c
> where ROTATEDIST is defined and a second one in tablefunc.c.

Nice, I had missed them as I my eyes set on pg_malloc(). I've done another pass over
the codebase and I can't spot any other on top of the additional ones you found where
MemSet() in palloc0 is preferrable over memset().

cheers ./daniel


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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Offline enabling/disabling of data checksums
Следующее
От: Pavan Deolasee
Дата:
Сообщение: Re: COPY FREEZE and setting PD_ALL_VISIBLE/visibility map bits