Re: Small improvements to pg_list.h's linitial(), lsecond(), lthird() etc macros

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Small improvements to pg_list.h's linitial(), lsecond(), lthird() etc macros
Дата
Msg-id CAApHDvpp9UU1VHfsDtnjU+XCyiRYFMDHwXcqXjOeVFH6zDydvQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Small improvements to pg_list.h's linitial(), lsecond(), lthird() etc macros  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Small improvements to pg_list.h's linitial(), lsecond(), lthird() etc macros
Re: Small improvements to pg_list.h's linitial(), lsecond(), lthird() etc macros
Список pgsql-hackers
On Mon, 28 Sep 2020 at 12:58, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> David Rowley <dgrowleyml@gmail.com> writes:
> > I'm a bit unsure about llast()'s new double evaluation of the list.
> > Perhaps I can add a new inline function named list_last_cell() to get
> > around that... Or maybe it doesn't matter. I'm not quite sure what's
> > best there.
>
> Double evaluation bad, especially in a macro that has not had such a
> hazard for the last twenty-plus years.
>
> It might not be worth mucking with llast, as it's not used very heavily
> I believe.  But if it is, then let's add another inline function.

Thanks for having a look at this.

I changed things around to make llast() and the int and oid variant
use a new inline function to get the last cell.

I also pushed the resulting code to master.

David



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

Предыдущее
От: "tsunakawa.takay@fujitsu.com"
Дата:
Сообщение: RE: Global snapshots
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Small improvements to pg_list.h's linitial(), lsecond(), lthird() etc macros