[MPlayer-dev-eng] [PATCH] replace glibc basename by macro to

Arpi arpi at thot.banki.hu
Sun Jan 26 16:59:08 CET 2003


Hi,

> +
> +#ifdef HAVE_LIBGEN_H
>  #include <libgen.h>
> +#else
> +#define basename(s) (strrchr(s,'/')==NULL?(char*)s:(strrchr(s,'/')+1))
> +#endif
>  

imho we shouldn't use libgen at all, even if available.
dirna,e() and basename() are so simple that can be implemented in a single
line macro of a few line function. we should put mp_basename() and
mp_dirname() into linux/ (soon: osdep/) dir.

why?
if we do #ifdef confition between own implementation and (sometimes buggy)
libgen.h implementation it makes testing and bugfixing a step harder. 
the libgen versions has some bugs and has strange unexpected behaviour
in some contexts. if we use own impleentation then we can exclude this
possible problem source.


A'rpi / Astral & ESP-team

--
Developer of MPlayer, the Movie Player for Linux - http://www.MPlayerHQ.hu


More information about the MPlayer-dev-eng mailing list