Re: mcxt.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Mendola Gaetano" <mendola(at)bigfoot(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: mcxt.c
Date: 2003-09-08 00:43:53
Message-ID: 16392.1062981833@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

"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).

If there's a reason for pstrdup in particular to do this, what is it?

regards, tom lane

In response to

  • mcxt.c at 2003-09-07 16:54:23 from Mendola Gaetano

Responses

  • Re: mcxt.c at 2003-09-08 09:33:52 from Gaetano Mendola
  • Re: mcxt.c at 2003-09-08 13:32:59 from Gaetano Mendola

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-09-08 00:57:04 Re: Unixware 713 probs
Previous Message Tom Lane 2003-09-08 00:38:05 Re: Needed function IF(expr, expr, expr)

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-09-08 00:57:04 Re: Unixware 713 probs
Previous Message Peter Eisentraut 2003-09-07 22:48:22 Re: WIN32_CONSOLE usage