Re: mcxt.c - Mailing list pgsql-patches

From Gaetano Mendola
Subject Re: mcxt.c
Date
Msg-id 001d01c3760d$c5971090$1f720b3e@mm.eutelsat.org
Whole thread Raw
In response to mcxt.c  ("Mendola Gaetano" <mendola@bigfoot.com>)
List pgsql-patches
"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-patches by date:

Previous
From: Kris Jurka
Date:
Subject: SQLState implementation for V3 Protocol
Next
From: "Gaetano Mendola"
Date:
Subject: Re: mcxt.c