Re: Remove useless casting to the same type
Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Jacob Champion <jacob.champion@enterprisedb.com>, pgsql-hackers@lists.postgresql.org
Date: 2025-11-28T14:42:32Z
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 →
-
Remove useless casting to same type
- 4f941d432b42 19 (unreleased) landed
-
Simplify hash_xlog_split_allocate_page()
- 35988b31db77 19 (unreleased) landed
Hi, On Fri, Nov 28, 2025 at 02:20:25PM +0100, Peter Eisentraut wrote: > On 28.11.25 10:06, Bertrand Drouvot wrote: > > On Fri, Nov 28, 2025 at 09:11:16AM +0100, Peter Eisentraut wrote: > > > I think this whole thing could be simplified by overlaying a uint32 over > > > "data" and just accessing the array fields normally. See attached patch. > > > > Indeed, that's a nice simplification. > > > > - data += sizeof(uint32) * 2; > > > > Is it safe? I mean could XLH_SPLIT_META_UPDATE_MASKS and XLH_SPLIT_META_UPDATE_SPLITPOINT > > be set simultaneously? > > Yes, that's what was probably intended. But apparently not exercised in the > tests. > > So maybe more like this patch. + uint32 lowmask = uidata[uidatacount++]; + uint32 highmask = uidata[uidatacount++]; good idea! That way that's easier to add more branches/flags later if we need to. Also, I think that's safe thanks to XLogRecGetBlockData() returning a MAXALIGNed buffer. Not sure if it's worth to add a comment. I think that a comment was not needed with the original code as it was using memcpy() instead. Except for the nit comment remark above, LGTM. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com