[vlc-commits] LUA: remove find_name() before something starts to use it

Rémi Denis-Courmont git at videolan.org
Thu May 26 18:12:58 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu May 26 19:10:40 2011 +0300| [2f49119c3b27a6b730c4dd1a82bb69a785c738c6] | committer: Rémi Denis-Courmont

LUA: remove find_name() before something starts to use it

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

 modules/lua/libs/objects.c |   50 --------------------------------------------
 share/lua/README.txt       |   11 +--------
 2 files changed, 1 insertions(+), 60 deletions(-)

diff --git a/modules/lua/libs/objects.c b/modules/lua/libs/objects.c
index 96905c0..32c2bd2 100644
--- a/modules/lua/libs/objects.c
+++ b/modules/lua/libs/objects.c
@@ -82,61 +82,12 @@ int vlclua_gc_release( lua_State *L )
     return 0;
 }
 
-static int vlc_object_search_mode_from_string( const char *psz_name )
-{
-    static const struct
-    {
-        int i_mode;
-        const char *psz_name;
-    } pp_modes[] =
-        { { FIND_CHILD, "child" },
-          { FIND_ANYWHERE, "anywhere" },
-          { 0, "" } };
-    int i;
-    for( i = 0; pp_modes[i].i_mode; i++ )
-    {
-        if( !strcmp( psz_name, pp_modes[i].psz_name ) )
-            return pp_modes[i].i_mode;
-    }
-    return 0;
-}
-
 static int vlclua_object_find( lua_State *L )
 {
     lua_pushnil( L );
     return 1;
 }
 
-static int vlclua_object_find_name( lua_State *L )
-{
-    const char *psz_name = luaL_checkstring( L, 2 );
-    const char *psz_mode = luaL_checkstring( L, 3 );
-
-    vlc_object_t *p_this;
-
-    int i_mode = vlc_object_search_mode_from_string( psz_mode );
-    vlc_object_t *p_result;
-
-    if( !i_mode )
-        return luaL_error( L, "\"%s\" is not a valid search mode.",
-                           psz_mode );
-
-    if( lua_type( L, 1 ) == LUA_TNIL )
-        p_this = vlclua_get_this( L );
-    else
-    {
-        vlc_object_t **p_obj = luaL_checkudata( L, 1, "vlc_object" );
-        p_this = *p_obj;
-    }
-
-    p_result = vlc_object_find_name( p_this, psz_name, i_mode );
-    if( !p_result )
-        lua_pushnil( L );
-    else
-        vlclua_push_vlc_object( L, p_result, vlclua_gc_release );
-    return 1;
-}
-
 static int vlclua_get_libvlc( lua_State *L )
 {
     vlclua_push_vlc_object( L, vlclua_get_this( L )->p_libvlc,
@@ -175,7 +126,6 @@ static const luaL_Reg vlclua_object_reg[] = {
     { "playlist", vlclua_get_playlist },
     { "libvlc", vlclua_get_libvlc },
     { "find", vlclua_object_find },
-    { "find_name", vlclua_object_find_name },
     { NULL, NULL }
 };
 
diff --git a/share/lua/README.txt b/share/lua/README.txt
index 15b2115..842c1c3 100644
--- a/share/lua/README.txt
+++ b/share/lua/README.txt
@@ -222,16 +222,7 @@ object.input(): Get the current input object.
 object.playlist(): Get the playlist object.
 object.libvlc(): Get the libvlc object.
 
-object.find( object, type, mode ): Find an object of given type. mode can
-  be "child" and "anywhere". If set to "child" it will look in "object"'s
-  children. If set to "anywhere", it will look in all the objects. If
-  object is unset, the current module's object will be used.
-  Type can be: "libvlc", "playlist", "input", "decoder",
-  "vout", "aout", "packetizer", "generic".
-  This function is deprecated and slow and should be avoided.
-object.find_name( object, name, mode ): Same as above except that it matches
-  on the object's name and not type. This function is also slow and should
-  be avoided if possible.
+object.find( object, type, mode ): Return nil. DO NOT USE.
 
 OSD
 ---



More information about the vlc-commits mailing list