[vlc-devel] [PATCH] Add missing 'environ' declaration (fix build on FreeBSD)

Rafaël Carré rafael.carre at gmail.com
Sun Nov 1 00:17:52 CET 2009


On Sun, 1 Nov 2009 00:08:51 +0200
"Rémi Denis-Courmont" <remi at remlab.net> wrote:

> Le samedi 31 octobre 2009 23:49:47 Rafael Carre, vous avez écrit :
> > Hi,
> > 
> > /media/bordel/vlc/modules/misc/xdg-screensaver.c:104: error:
> >                 'environ' undeclared (first use in this function)
> > 
> > On FreeBSD, man 7 environ says:
> > 
> > SYNOPSIS
> >      extern char **environ;
> 
> Are extern declaration inside functions legal (outside GNU C)?

Extract from an example in my ISO/IEC 9899:1999 draft:

void g(void)
{
      extern int d[100];
      f(50, d + 50, d); // valid
      f(50, d + 1, d); // undefined behavior
}

So I suppose it's ok (anyway do we support any compiler which is not
gcc?)


BTW extern char **environ; is in unistd.h on linux:

#ifdef __USE_GNU
extern char **environ;
#endif

And having another declaration in xdg-screensaver.c doesn't harm.

So I'll just commit this

-- 
Rafaël Carré
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20091101/64e39d24/attachment.sig>


More information about the vlc-devel mailing list