Re: Use C11 alignas instead of palloc/malloc for alignment - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Use C11 alignas instead of palloc/malloc for alignment
Date
Msg-id 45e3c87f-b783-4221-8f81-375a1fe2638b@eisentraut.org
Whole thread
List 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.




pgsql-hackers by date:

Previous
From: shveta malik
Date:
Subject: Re: Distinguish publication exclusions in object addresses
Next
From: Amit Kapila
Date:
Subject: Re: Distinguish publication exclusions in object addresses