Re: mcxt.c - Mailing list pgsql-hackers

From Gaetano Mendola
Subject Re: mcxt.c
Date
Msg-id 000e01c375ec$b1a491f0$27700b3e@mm.eutelsat.org
Whole thread Raw
Responses Re: mcxt.c  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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 by date:

Previous
From: "Zeugswetter Andreas SB SD"
Date:
Subject: Re: Index creation takes for ever
Next
From: Manfred Koizar
Date:
Subject: Re: Index creation takes for ever