[MPlayer-dev-eng] [PATCH] mplayer.c

Björn Sandell biorn at dce.chalmers.se
Mon Mar 28 12:38:45 CEST 2005


On Mon, 28 Mar 2005 10:15:01 +0200
Oded Shimon <ods15 at ods15.dyndns.org> wrote:

> On Sun, Mar 27, 2005 at 10:17:54PM -0500, D Richard Felker III wrote:
> > On Sun, Mar 27, 2005 at 07:23:06PM -0600, Joey Parrish wrote:
> > > On Sun, Mar 27, 2005 at 09:10:39PM +0200, Bj?rn Sandell wrote:
> > > > Avoid some missing sentinel warnings.
> > > 
> > > > -          if (execlp("gdb", "gdb", prog_path, spid, NULL) ==
> > > > -1) +          if (execlp("gdb", "gdb", prog_path, spid, (void
> > > > *)NULL) == -1)
> > > 
> > > > -          execl("/bin/sh","sh","-c",cmd->args[0].v.s,NULL);
> > > > +          execl("/bin/sh","sh","-c",cmd->args[0].v.s,(void
> > > > *)NULL);
> > > 
> > > This is silly.  There should be no need to cast compatible
> > > constants.
> > > 
> > > 1) NULL should always be assumed to be a pointer (common sense)
> > > 2) even treating NULL as int, C doesn't care about such stupid
> > >     casting, only C++ would complain
> > > 
> > > What good is this patch?  What is sentinel?

mplayer.c:3485: warning: missing sentinel in function call
 
> > Actually with functions which take a variable number of arguments,
> > it _does_ matter, since there is no profile to force the right
> > promotion of 0 to a pointer type. However, NULL is already (void*)0,
> > so this is nonsense (strictly speaking C allows it to be defined as
> > 0 I think, but no sane implementation does that..).
> 
> If you want to be really anal, the "correct" thing to put is '(char
> *)0', but  I don't think there is any modern architecture where this
> matters. This patch  is totally useless, because NULL already is
> '(void *)0'.

Well, I used (char *) nut changed it to (void *) due to
libmenu/menu_console.c rev 1.6. 

It seems as I'm on one of those insane OSes where NULL is 0L; will
applying the diff break stuff on any system (where NULL is (void *)0)?

-- 
Björn Sandell           Chalmers University of Technology
IT department    www.ita.chalmers.se   +46 (0)31 772 1000




More information about the MPlayer-dev-eng mailing list