Convert macros to static inline functions
Peter Eisentraut <peter.eisentraut@enterprisedb.com>
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-05-16T08:27:58Z
Lists: pgsql-hackers
Attachments
- 0001-Convert-macros-to-static-inline-functions-block.h.patch (text/plain) patch 0001
- 0002-Convert-macros-to-static-inline-functions-bufpage.h.patch (text/plain) patch 0002
- 0003-Convert-macros-to-static-inline-functions-itemptr.h.patch (text/plain) patch 0003
- 0004-Convert-macros-to-static-inline-functions-bufmgr.h.patch (text/plain) patch 0004
- 0005-Convert-macros-to-static-inline-functions-xlog_inter.patch (text/plain) patch 0005
- 0006-Convert-macros-to-static-inline-functions-tupmacs.h.patch (text/plain) patch 0006
- 0007-Convert-macros-to-static-inline-functions-itup.h.patch (text/plain) patch 0007
- 0008-Convert-macros-to-static-inline-functions-pgstat.h.patch (text/plain) patch 0008
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
Commits
-
Add some const decorations (htup.h)
- b15b8c5cf882 18.0 landed
-
Convert macros to static inline functions (htup_details.h, itup.h)
- 34694ec888d6 18.0 landed
-
Convert macros to static inline functions (rel.h)
- 3edc71ec0438 16.0 landed
-
Convert macros to static inline functions (itup.h)
- 14a8bd98274a 16.0 landed
-
Convert macros to static inline functions (tupmacs.h)
- f58d7073b775 16.0 landed
-
Convert macros to static inline functions (xlog_internal.h)
- 507ba16b28c7 16.0 landed
-
Convert macros to static inline functions (bufmgr.h)
- 9c727360bcc7 16.0 landed
-
Convert macros to static inline functions (itemptr.h)
- aeb767ca0b02 16.0 landed
-
Convert macros to static inline functions (bufpage.h)
- 2cd2569c72b8 16.0 landed
-
Convert macros to static inline functions (block.h)
- d63d957e330c 16.0 landed