[MPlayer-dev-eng] [PATCH] osd menu fielsel.c

Alban Bedel albeu at free.fr
Thu Nov 21 16:09:53 CET 2002


Hi Björn Sandell,

on Thu, 21 Nov 2002 10:28:13 +0100 you wrote:

> On Thu, 21 Nov 2002 07:23:02 +0100
> Alban Bedel <albeu at free.fr> wrote:
> 
> > Hi Björn Sandell,
> > 
> > on Tue, 19 Nov 2002 18:59:09 +0100 you wrote:
> > 
> > > 
> > > Howdy,
> > > 
> > > A patch to make menu_filesel.c a bit more portable. Tested on RedHat
> > > and OpenBSD.
> > Can you explain me what is not portable in this file (not that i don't
> > believe you) ?
> 
> I'll try :-)
> 
> Include limitd.h to define PATH_MAX (tested on Solaris & OpenBSD)
> Avoid defining functions within functions. This breaks (SIGSEGV) on
> OpenBSD and I think it is because OpenBSD has a non-exec stack.
np with that.

> Maybe one should try to avoid scandir() also and use readdir() instead.
> From'man scandir' on Solaris:
> 
> NOTES
>      Use of these interfaces should be restricted to only  appli-
>      cations  written on  BSD platforms.  Use of these interfaces
>      with any of the system libraries or in multi-thread applica-
>      tions is unsupported.
> 
> > And what is the use of this d_type thing instead of stat ?
> 
> Well, it seems unnessecary to do stat() to figure out something you
> already know, and it makes it much easier to move the definition of
> compare() out of oper_dir().
> 
> Ok?
Only one thing bug me with this. I don't really like to have to add configure detection,
#ifdef, etc only to read a simple directory. I think you'r right it should use only readdir
as it's posix. But i don't want this d_type field if it has to fallback on stat when it's not
avaible. There's no speed concern here so there is no point in implementing the
same thing 2 times. So keep it simple and use as less as possible #ifdef.
Do you want to do that or shall i put it on my endless TODO (medium to low priority) ?
	Albeu



More information about the MPlayer-dev-eng mailing list