Re: mcxt.c

From: "Gaetano Mendola" <mendola(at)bigfoot(dot)com>
To: <pgsql-patches(at)postgresql(dot)org>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: mcxt.c
Date: 2003-09-08 13:32:59
Message-ID: 001d01c3760d$c5971090$1f720b3e@mm.eutelsat.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Mendola Gaetano" <mendola(at)bigfoot(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruno Wolff III 2003-09-08 13:42:10 Re: on-disk format changes
Previous Message Bruno Wolff III 2003-09-08 13:27:00 Re: on-disk format changes

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-09-08 13:57:30 Re: mcxt.c
Previous Message Kris Jurka 2003-09-08 12:17:52 SQLState implementation for V3 Protocol