Re: remove obsolete NULL casts

From: Kurt Roeckx <Q(at)ping(dot)be>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: remove obsolete NULL casts
Date: 2004-01-05 22:18:50
Message-ID: 20040105221850.GA20934@ping.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On Mon, Jan 05, 2004 at 04:31:40PM -0500, Neil Conway wrote:
> In any modern dialect of C, casting the "NULL" pointer literal to a
> specific pointer type is unnecessary. For example:
>
> char *foo;
> foo = malloc(...);
> if (foo == (char *) NULL) {...}

In src/backend/port/darwin/system.c you replaced:

execl(_PATH_BSHELL, "sh", "-c", command, (char *) NULL);

By:
execl(_PATH_BSHELL, "sh", "-c", command, NULL);

I think that is one of the exceptions where you do have to cast
it, because the type is unknown. You can only remove the cast
when you actually know what pointer type it is.

Kurt

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2004-01-06 00:18:47 Re: minor smgr code cleanup
Previous Message Andrew Dunstan 2004-01-05 21:45:09 logging statement levels