Re: mcxt.c

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: mcxt.c
Дата
Msg-id 16392.1062981833@sss.pgh.pa.us
обсуждение исходный текст
Ответ на mcxt.c  ("Mendola Gaetano" <mendola@bigfoot.com>)
Список pgsql-patches
"Mendola Gaetano" <mendola@bigfoot.com> writes:
> A test for null string is missing here:

> MemoryContextStrdup(MemoryContext context, const char *string)
> {
> char *nstr;
> -
> - if ( !string )
> - {
> - elog(ERROR, "MemoryContextStrdup called with a NULL pointer");
> - return NULL;
> - }

This seems inappropriate to me.  Are you going to suggest that every
routine that takes a pointer parameter needs to explicitly test for
null?  We could bloat the code a great deal that way, and slow it down,
without gaining anything at all in debuggability (IMHO anyway).

If there's a reason for pstrdup in particular to do this, what is it?

            regards, tom lane

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Index creation takes for ever
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Unixware 713 probs