Commit 1231f33d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vlc_scandir: remove (dead) code

parent 22fe2438
......@@ -724,10 +724,6 @@ VLC_EXPORT( int, vlc_asprintf, (char **, const char *, ... ) ATTRIBUTE_FORMAT( 2
VLC_EXPORT( size_t, vlc_strlcpy, ( char *, const char *, size_t ) );
VLC_EXPORT( int64_t, vlc_strtoll, ( const char *nptr, char **endptr, int base ) );
struct dirent;
VLC_EXPORT( int, vlc_scandir, ( const char *name, struct dirent ***namelist, int (*filter) ( const struct dirent * ), int (*compar) ( const struct dirent **, const struct dirent ** ) ) );
VLC_EXPORT( int, vlc_alphasort, ( const struct dirent **a, const struct dirent **b ) );
VLC_EXPORT( char *, vlc_strcasestr, ( const char *s1, const char *s2 ) );
#if defined(WIN32) || defined(UNDER_CE)
......
......@@ -70,10 +70,6 @@
# include <windows.h>
#endif
#ifdef UNDER_CE
# define strcoll strcmp
#endif
/******************************************************************************
* strcasestr: find a substring (little) in another substring (big)
* Case sensitive. Return NULL if not found, return big if little == null
......@@ -378,72 +374,6 @@ void vlc_rewinddir( void *_p_dir )
}
#endif
/*****************************************************************************
* scandir: scan a directory alpha-sorted
*****************************************************************************/
#if !defined( HAVE_SCANDIR )
/* FIXME: I suspect this is dead code -> utf8_scandir */
#ifdef WIN32
# undef opendir
# undef readdir
# undef closedir
#endif
int vlc_alphasort( const struct dirent **a, const struct dirent **b )
{
return strcoll( (*a)->d_name, (*b)->d_name );
}
int vlc_scandir( const char *name, struct dirent ***namelist,
int (*filter) ( const struct dirent * ),
int (*compar) ( const struct dirent **,
const struct dirent ** ) )
{
DIR * p_dir;
struct dirent * p_content;
struct dirent ** pp_list;
int ret, size;
if( !namelist || !( p_dir = opendir( name ) ) ) return -1;
ret = 0;
pp_list = NULL;
while( ( p_content = readdir( p_dir ) ) )
{
if( filter && !filter( p_content ) )
{
continue;
}
pp_list = realloc( pp_list, ( ret + 1 ) * sizeof( struct dirent * ) );
size = sizeof( struct dirent ) + strlen( p_content->d_name ) + 1;
pp_list[ret] = malloc( size );
if( pp_list[ret] )
{
memcpy( pp_list[ret], p_content, size );
ret++;
}
else
{
/* Continuing is useless when no more memory can be allocted,
* so better return what we have found.
*/
ret = -1;
break;
}
}
closedir( p_dir );
if( compar )
{
qsort( pp_list, ret, sizeof( struct dirent * ),
(int (*)(const void *, const void *)) compar );
}
*namelist = pp_list;
return ret;
}
#endif
#if defined (WIN32)
/**
* gettext callbacks for plugins.
......
......@@ -369,7 +369,6 @@ __var_Get
__var_Set
__var_TriggerCallback
__var_Type
vlc_alphasort
vlc_asprintf
vlc_b64_decode
vlc_b64_decode_binary
......@@ -435,7 +434,6 @@ __vlc_object_yield
vlc_pthread_fatal
vlc_rand_bytes
vlc_recvmsg
vlc_scandir
vlc_sdp_Start
vlc_sendmsg
vlc_strcasestr
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment