In [1], Matthias is proposing to introduce a new system memory context type that basically ties palloc directly to malloc. While reviewing that patch, I noticed it copied a usage of sentinel_ok() that deviates from the norm. Technically it's fine, as sentinel_ok()'s first parameter is a void pointer, so passing the MemoryChunk rather than what palloc() would return is fine, provided you add on the byte difference to the MemoryChunk. I felt the need to mention the weirdness during the review, and since people clearly copy a load of code from an existing context type when adding new ones, it means that pattern is going to be copied again when the next person adds a new allocator.
I thought it might be good to adjust this at the source to prevent that. Anyone disagree? Patch attached. David [1] https://postgr.es/m/caaphdvp_-zh5cdr_anaucxgheddwc0b1a5kijpc1ckdg0vx...@mail.gmail.com
v1-0001-Adjust-weird-usages-of-sentinel_ok.patch
Description: Binary data
