Re: more psprintf() use - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: more psprintf() use
Date
Msg-id 52C51A1C.90904@vmware.com
Whole thread Raw
In response to more psprintf() use  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: more psprintf() use
List pgsql-hackers
On 01/02/2014 05:14 AM, Peter Eisentraut wrote:
> diff --git a/contrib/hstore/hstore_io.c b/contrib/hstore/hstore_io.c
> index 772a5ca..8331a56 100644
> --- a/contrib/hstore/hstore_io.c
> +++ b/contrib/hstore/hstore_io.c
> @@ -1114,11 +1114,7 @@
>       HEntry       *entries = ARRPTR(in);
>
>       if (count == 0)
> -    {
> -        out = palloc(1);
> -        *out = '\0';
> -        PG_RETURN_CSTRING(out);
> -    }
> +        PG_RETURN_CSTRING("");
>
>       buflen = 0;

Is it legal to return a constant with PG_RETURN_CSTRING? Grepping 
around, I don't see that being done anywhere else, but there are places 
that do PG_RETURN_CSTRING(pstrdup(<constant>))...

- Heikki



pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: preserving forensic information when we freeze
Next
From: Andres Freund
Date:
Subject: Re: preserving forensic information when we freeze