Re: Convert varatt.h macros to static inline functions
Greg Burd <greg@burd.me>
From: Greg Burd <greg@burd.me>
To: Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter@eisentraut.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-07-31T14:44:22Z
Lists: pgsql-hackers
> On Jul 31, 2025, at 10:06 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > > Peter Eisentraut <peter@eisentraut.org> writes: >> I had this lying around as a draft patch, as part of my ongoing campaign >> to convert many complicated macros to static inline functions. Since >> the topic was mentioned in another thread [0], I cleaned up the patch so >> that we can all look at it. > > I had just finished doing exactly that, per my idea in the other > thread of providing both pointer and Datum variants where needed. > I'll look more closely at yours in a bit, but here's mine. > > regards, tom lane Thank you both for diving into this, I really appreciate the clarity this brings to the code. I've applied both patches and compared the two approaches. I build and tested Peter's patches on macOS (15.5, M3 Pro) using meson and found no issues. It's clear you both had the same idea in mind, but with slight differences in application. I find VARDATA(DatumGetPointer(key_datums[I])) to be more clear than VARDATA_D(key_datums[I]). Yes, the line length suffers a bit but I find it much more readable. I'm +1 for changes like this, and this one in particular. Just my $0.02, best. -greg
Commits
-
Suppress maybe-uninitialized warning.
- b5c53b403c93 19 (unreleased) landed
-
Convert varatt.h access macros to static inline functions.
- e035863c9a04 19 (unreleased) landed
-
Fix varatt versus Datum type confusions
- 0f5ade7a367c 19 (unreleased) landed