Re: mcxt.c

From: "Gaetano Mendola" <mendola(at)bigfoot(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: mcxt.c
Date: 2003-09-08 09:33:52
Message-ID: 000e01c375ec$b1a491f0$27700b3e@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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Pflug 2003-09-08 10:52:26 Re: Unixware 713 probs
Previous Message Zeugswetter Andreas SB SD 2003-09-08 09:31:05 Re: [HACKERS] Index creation takes for ever

Browse pgsql-patches by date

  From Date Subject
Next Message Christoph Dalitz 2003-09-08 10:27:05 Re: [PATCHES] WIN32_CONSOLE usage
Previous Message Zeugswetter Andreas SB SD 2003-09-08 09:31:05 Re: [HACKERS] Index creation takes for ever