Re: Consistently use palloc_object() and palloc_array()

2025-11-28 Thread Thomas Munro
On Sat, Nov 29, 2025 at 10:47 AM David Geier wrote: > I intentionally tried to avoid any semantic changes but it's of course > possible something slipped through by accident. Do you expect the generated code to be identical? Is it?

Re: Consistently use palloc_object() and palloc_array()

2025-11-28 Thread David Geier
On 28.11.2025 22:28, Tom Lane wrote: > David Geier writes: >> On 27.11.2025 00:03, Chao Li wrote: >>> This is a large patch, I just take a quick look, and found that: >>> - *phoned_word = palloc(sizeof(char) * strlen(word) + 1); >>> + *phoned_word = palloc_array(char, strlen(wo

Re: Consistently use palloc_object() and palloc_array()

2025-11-28 Thread David Geier
Hi Thomas! On 27.11.2025 03:53, Thomas Munro wrote: > On Thu, Nov 27, 2025 at 11:10 AM David Geier wrote: >> I've changed all code to use the "new" palloc_object(), palloc_array(), >> palloc0_object(), palloc0_array, repalloc_array() and repalloc0_array() >> macros. This makes the code more reada

Re: Consistently use palloc_object() and palloc_array()

2025-11-28 Thread David Geier
Hi Michael! On 27.11.2025 01:24, Michael Paquier wrote: > On Wed, Nov 26, 2025 at 11:09:31PM +0100, David Geier wrote: >> I've changed all code to use the "new" palloc_object(), palloc_array(), >> palloc0_object(), palloc0_array, repalloc_array() and repalloc0_array() >> macros. This makes the cod

Re: Consistently use palloc_object() and palloc_array()

2025-11-28 Thread Tom Lane
David Geier writes: > On 27.11.2025 00:03, Chao Li wrote: >> This is a large patch, I just take a quick look, and found that: >> -*phoned_word = palloc(sizeof(char) * strlen(word) + 1); >> +*phoned_word = palloc_array(char, strlen(word) + 1); >> And >> -params =

Re: Consistently use palloc_object() and palloc_array()

2025-11-28 Thread David Geier
Hi! Thanks for taking a look. On 27.11.2025 00:03, Chao Li wrote: > > This is a large patch, I just take a quick look, and found that: > > ``` > - *phoned_word = palloc(sizeof(char) * strlen(word) + 1); > + *phoned_word = palloc_array(char, strlen(word) + 1); > ``` > >

Re: Consistently use palloc_object() and palloc_array()

2025-11-26 Thread Michael Paquier
On Wed, Nov 26, 2025 at 10:25:12PM -0500, Tom Lane wrote: > Hmm ... I had the same doubts as Michael about whether this change > could possibly be worth the ensuing back-patching pain. But if > it leads to an improvement in type-safety, that'd be a reason to > take on the work. Yeah, that sounds

Re: Consistently use palloc_object() and palloc_array()

2025-11-26 Thread Tom Lane
Thomas Munro writes: > This isn't a fully-baked thought, just a thought that occurred to me > while looking into that: If palloc_object(Int128AggState) were smart > enough to detect that alignof(T) > MAXALIGN and redirect to > palloc_aligned(sizeof(T), alignof(T), ...) at compile time, then > Int

Re: Consistently use palloc_object() and palloc_array()

2025-11-26 Thread Thomas Munro
On Thu, Nov 27, 2025 at 11:10 AM David Geier wrote: > I've changed all code to use the "new" palloc_object(), palloc_array(), > palloc0_object(), palloc0_array, repalloc_array() and repalloc0_array() > macros. This makes the code more readable and more consistent. I wondered about this in the con

Re: Consistently use palloc_object() and palloc_array()

2025-11-26 Thread Michael Paquier
On Wed, Nov 26, 2025 at 11:09:31PM +0100, David Geier wrote: > I've changed all code to use the "new" palloc_object(), palloc_array(), > palloc0_object(), palloc0_array, repalloc_array() and repalloc0_array() > macros. This makes the code more readable and more consistent. > > The patch is pretty b

Re: Consistently use palloc_object() and palloc_array()

2025-11-26 Thread Chao Li
> On Nov 27, 2025, at 06:09, David Geier wrote: > > Hi hackers, > > I've changed all code to use the "new" palloc_object(), palloc_array(), > palloc0_object(), palloc0_array, repalloc_array() and repalloc0_array() > macros. This makes the code more readable and more consistent. > > The patch