Hi Aleksander,
On Thu, Nov 20, 2025 at 05:01:49PM +0300, Aleksander Alekseev wrote:
> 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:
Thanks for looking at it!
>
> ```
> - 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.
Yes, that's what it is doing and so was 7f798aca1d5.
For example in 7f798aca1d5, you can also see things like:
@@ -858,7 +858,7 @@ setup_firstcall(FuncCallContext *funcctx, HStore *hs,
st = (HStore *) palloc(VARSIZE(hs));
memcpy(st, hs, VARSIZE(hs));
- funcctx->user_fctx = (void *) st;
+ funcctx->user_fctx = st;
Where funcctx->user_fctx is of type (void *) and st is of type (HStore *).
> Personally I don't think this is a good change.
Only this one (because maybe databuf is used twice) or the whole idea of 7f798aca1d5
and this patch?
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com