Re: Use C11 alignas instead of palloc/malloc for alignment

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Use C11 alignas instead of palloc/malloc for alignment
Date: 2026-09-16 08:22:44
Message-ID: 45e3c87f-b783-4221-8f81-375a1fe2638b@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 08.09.26 16:05, Andrew Dunstan wrote:
>
> On 2026-09-08 Tu 6:08 AM, Peter Eisentraut wrote:
>> There are a number of places where palloc()/malloc()/etc. was used
>> solely to obtain an aligned buffer.  We can do these much simpler by
>> using alignas with a local variable instead.  See attached patch.
>>
>> One of these revealed a small problem with how pgindent handles
>> alignas (it doesn't know about it and it might or might not work well
>> depending on context), so I added a workaround into pgindent to fix
>> that.  (Or we could try to reshuffle that code to avoid the problem.)
>
>
> The pgindent recipe should possibly be hardened for things like nested
> parens. Here's a reworked patch 2.

Thanks, this is a clever solution. I have committed this separately.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-09-16 08:24:45 Re: Distinguish publication exclusions in object addresses
Previous Message shveta malik 2026-09-16 08:21:37 Re: Distinguish publication exclusions in object addresses