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: Convert macros to static inline functions
Date: 2022-05-16 08:27:58
Message-ID: 5b558da8-99fb-0a99-83dd-f72f05388517@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Inspired by [0], I looked to convert more macros to inline functions.
The attached patches are organized "bottom up" in terms of their API
layering; some of the later ones depend on some of the earlier ones.

Note 1: Some macros that do by-value assignments like

#define PageXLogRecPtrSet(ptr, lsn) \
((ptr).xlogid = (uint32) ((lsn) >> 32), (ptr).xrecoff = (uint32) (lsn))

can't be converted to functions without changing the API, so I left
those alone for now.

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.

[0]:
https://www.postgresql.org/message-id/202203241021.uts52sczx3al@alvherre.pgsql

Attachment Content-Type Size
0001-Convert-macros-to-static-inline-functions-block.h.patch text/plain 2.8 KB
0002-Convert-macros-to-static-inline-functions-bufpage.h.patch text/plain 9.9 KB
0003-Convert-macros-to-static-inline-functions-itemptr.h.patch text/plain 6.1 KB
0004-Convert-macros-to-static-inline-functions-bufmgr.h.patch text/plain 2.7 KB
0005-Convert-macros-to-static-inline-functions-xlog_inter.patch text/plain 6.9 KB
0006-Convert-macros-to-static-inline-functions-tupmacs.h.patch text/plain 7.7 KB
0007-Convert-macros-to-static-inline-functions-itup.h.patch text/plain 4.5 KB
0008-Convert-macros-to-static-inline-functions-pgstat.h.patch text/plain 7.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message osumi.takamichi@fujitsu.com 2022-05-16 08:29:58 RE: Skipping schema changes in publication
Previous Message torikoshia 2022-05-16 08:02:40 Re: RFC: Logging plan of the running query