Re: Add new for_each macros for iterating over a List that do not require ListCell pointer

From: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add new for_each macros for iterating over a List that do not require ListCell pointer
Date: 2023-12-14 15:54:57
Message-ID: CAGECzQSdUgxNcA=kJVuc=o6NbiZBa=4CA-0kAjFxQAYjx8A6JA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 1 Dec 2023 at 05:20, Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
> Could we simplify it with something like the following?

Great suggestion! Updated the patchset accordingly.

This made it also easy to change the final patch to include the
automatic scoped declaration logic for all of the new macros. I quite
like how the calling code changes to not have to declare the variable.
But it's definitely a larger divergence from the status quo than
without patch 0003. So I'm not sure if it's desired.

Finally, I also renamed the functions to use foreach instead of
for_each, since based on this thread that seems to be the generally
preferred naming.

Attachment Content-Type Size
v6-0002-Use-new-for_each_xyz-macros-in-a-few-places.patch application/octet-stream 7.3 KB
v6-0001-Add-macros-for-looping-through-a-list-without-nee.patch application/octet-stream 3.5 KB
v6-0003-Even-more-convenient-macros.patch application/octet-stream 7.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tristan Partin 2023-12-14 16:53:39 Re: Add --check option to pgindent
Previous Message Ashutosh Bapat 2023-12-14 15:44:23 Re: logical decoding and replication of sequences, take 2