Re: Avoid use scoped block variable - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: Avoid use scoped block variable
Date
Msg-id b5f92b03-70d6-4958-b9b0-111fab0f2ab6@vondra.me
Whole thread Raw
In response to Avoid use scoped block variable  (Ranier Vilela <ranier.vf@gmail.com>)
List pgsql-hackers
On 12/9/25 17:06, Ranier Vilela wrote:
> Hi.
> 
> I noticed a possible violation of C rules.
> Some functions rely on local block variables, 
> but this are a mistake.
> Once that block exits, the memory of the variable is released.
> 
> Fix by moving the declaration variables.
> 

When you say "possible violation", did you check the issue is real?

All these places call CStringGetTextDatum, which calls cstring_to_text,
which allocates a new varlena copy of the string. So why is this an
issue, exactly?


regards

-- 
Tomas Vondra




pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Avoid use scoped block variable
Next
From: Bertrand Drouvot
Date:
Subject: Mark function arguments of type "T *" as "const T *" where possible