Re: best place for xstrdup - Mailing list pgsql-hackers

From Mendola Gaetano
Subject Re: best place for xstrdup
Date
Msg-id 028901c37c65$ed346180$152aa8c0@GMENDOLA2
Whole thread Raw
In response to best place for xstrdup  ("Mendola Gaetano" <mendola@bigfoot.com>)
List pgsql-hackers
"Tom Lane" <tgl@sss.pgh.pa.us> wrote:
> "Mendola Gaetano" <mendola@bigfoot.com> writes:
> >     if ( !ret_value ) {
> >         ereport(FATAL,
> >                                 (errcode(ERRCODE_OUT_OF_MEMORY),
> >                                  errmsg("strdup out of memory")));
> >     }
> 
> Should be ERROR not FATAL (the places that are insisting on FATAL are
> special cases that won't be able to use this code).  Also the text
> should just be "out of memory".

Ok.

> Per previous discussion, I don't believe in the test for null input,
> either ...

Ok ok, I just tried :-)
> It might be worth creating an xmalloc as well, since I think there
> are some unchecked malloc's in some places.

I'll see

> As for where to put it, mcxt.c may be the best place.  aset.c does
> not contain any routines that are supposed to be globally known.

Ok


Regards
Gaetano Mendola




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: best place for xstrdup
Next
From: Tom Lane
Date:
Subject: New thoughts about indexing cross-type comparisons