[vlc-devel] commit: vlc_scandir: remove (dead) code ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat May 24 11:44:19 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Sat May 24 12:45:46 2008 +0300| [1231f33d9c2d07117ed4f1615592d4fff4609e27]

vlc_scandir: remove (dead) code

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1231f33d9c2d07117ed4f1615592d4fff4609e27
---

 include/vlc_common.h |    4 ---
 src/extras/libc.c    |   70 --------------------------------------------------
 src/libvlccore.sym   |    2 -
 3 files changed, 0 insertions(+), 76 deletions(-)

diff --git a/include/vlc_common.h b/include/vlc_common.h
index 87f2e90..172d8af 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -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)
diff --git a/src/extras/libc.c b/src/extras/libc.c
index 5b8e9b2..39d6250 100644
--- a/src/extras/libc.c
+++ b/src/extras/libc.c
@@ -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.
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 0f4a141..4c3aff1 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -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




More information about the vlc-devel mailing list