Re: Remove useless casts to (void *)

Aleksander Alekseev <aleksander@tigerdata.com>

From: Aleksander Alekseev <aleksander@tigerdata.com>
To: pgsql-hackers@lists.postgresql.org
Cc: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, Peter Eisentraut <peter@eisentraut.org>
Date: 2025-11-20T14:01:49Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Remove useless casts to (void *)

Hi Bertrand,

> The attached also remove casts that have been added since 7f798aca1d5, the ones
> in pg_publication.c, lock.c and tuplesortvariants.c.
>
> The patch has been generated with the help of the .cocci script [2] (though I
> manually reviewed and removed some matches that, I think, were not appropriate).

I didn't review the entire patch but one change caught my attention:

```
-               databuf = (void *) ((char *) databuf + avail);
+               databuf = (char *) databuf + avail;
```

Here `databuf` has a type (void*). Although the code is correct, it
replaces an explicit cast (which I read "yes, we know what we are
doing") with an implicit one. Personally I don't think this is a good
change.

These were just my two cents. All in all I'm neither for nor against the patch.

-- 
Best regards,
Aleksander Alekseev