Hi,
On Mon, Nov 24, 2025 at 11:20:56AM +0100, Peter Eisentraut wrote:
> In a previous thread[0], the question was asked, 'Why do we bother with a
> "Pointer" type?'. So I looked into get rid of it.
>
> There are two stages to this. One is changing all code that wants to do
> pointer arithmetic to use char * instead of relying on Pointer being char *.
> Then we can change Pointer to be void * and remove a bunch of casts.
>
> The second is getting rid of uses of Pointer for variables where you might
> as well use void * directly. These are actually not that many.
>
> This gets rid of all uses, except in the GIN code, which is full of Pointer
> use, and it's part of the documented API. I'm not touching that, not least
> because this kind of code
>
> Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4);
>
> needs more brain-bending to understand that I'm prepared to spend. So as
> far as I'm concerned, the pointer type can continue to exist as a curiosity
> of the GIN API, but in all other places, it wasn't really doing much of
> anything anyway.
The patch series is very easy to follow, thanks! I agree with the idea: we now
use (char *) for byte(s) manipulation and (void *) for generic pointer usage.
I checked the changes and if any have been missed and that looks ok to me.
Just a nit, while at it, maybe we could get rid of those extra parentheses:
@@ -140,20 +140,20 @@ GinDataLeafPageGetItems(Page page, int *nitems, ItemPointerData advancePast)
{
GinPostingList *seg = GinDataLeafPageGetPostingList(page);
Size len = GinDataLeafPageGetPostingListSize(page);
- Pointer endptr = ((Pointer) seg) + len;
+ char *endptr = ((char *) seg) + len;
The other existing ones in some macros are good to keep.
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com