Re: mcxt.c
| От | Gaetano Mendola |
|---|---|
| Тема | Re: mcxt.c |
| Дата | |
| Msg-id | 000e01c375ec$b1a491f0$27700b3e@mm.eutelsat.org обсуждение исходный текст |
| Ответы |
Re: mcxt.c
|
| Список | pgsql-hackers |
"Tom Lane" <tgl@sss.pgh.pa.us> wrote:
> "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).
Of course I'm not suggesting this, what I'm suggesting is put an
assert( ) if the test can slow down the performances and an "if ( ) "
in places that are not going to touch the performances.
I think that is reasonable.
Regards
Gaetano Mendola
В списке pgsql-hackers по дате отправления: