Re: best place for xstrdup

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: best place for xstrdup
Дата
Msg-id 17408.1063724908@sss.pgh.pa.us
обсуждение исходный текст
Ответ на best place for xstrdup  ("Mendola Gaetano" <mendola@bigfoot.com>)
Список pgsql-hackers
"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".

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

It might be worth creating an xmalloc as well, since I think there
are some unchecked malloc's in some places.

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.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Mendola Gaetano"
Дата:
Сообщение: best place for xstrdup
Следующее
От: "Mendola Gaetano"
Дата:
Сообщение: Re: best place for xstrdup