Re: Convert macros to static inline functions

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Convert macros to static inline functions
Date: 2024-12-27 10:16:46
Message-ID: 3da52a89-d57c-492e-b987-0467f062a1bd@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16.05.22 10:27, Peter Eisentraut wrote:
> Inspired by [0], I looked to convert more macros to inline functions.

This is an older thread where I left something unfinished:

> Note 2: Many macros in htup_details.h operate both on HeapTupleHeader
> and on MinimalTuple, so converting them to a function doesn't work in a
> straightforward way.  I have some in-progress work in that area, but I
> have not included any of that here.

Here is the patch set for this.

There are actually only two macros that operate on both HeapTupleHeader
and MinimalTuple, so it wasn't as much as I had written above. I just
left those as macros. I converted the rest to inline functions in a
straightforward way as before. A small amount of reordering was necessary.

But just for language-nerd fun, I'm including here an additional patch
showing how the remaining ones could be done with C11 generic selection.
I'm not planning to commit that one at this time.

Attachment Content-Type Size
0001-Add-some-const-decorations-htup.h.patch text/plain 3.0 KB
0002-Convert-macros-to-static-inline-functions-htup_detai.patch text/plain 20.3 KB
0003-WIP-Use-some-generic-selection.patch text/plain 2.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2024-12-27 11:05:07 Re: Fix bank selection logic in SLRU
Previous Message Hayato Kuroda (Fujitsu) 2024-12-27 09:48:33 RE: Logical Replication of sequences