[vlc-commits] Lua: remove unused XML validator
    Rémi Denis-Courmont 
    git at videolan.org
       
    Thu Jul  2 20:12:51 CEST 2015
    
    
  
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Jul  2 21:09:25 2015 +0300| [8e0838955aad7968278b3a72b1b4139db546f4a4] | committer: Rémi Denis-Courmont
Lua: remove unused XML validator
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8e0838955aad7968278b3a72b1b4139db546f4a4
---
 modules/lua/libs/xml.c |   20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)
diff --git a/modules/lua/libs/xml.c b/modules/lua/libs/xml.c
index 80f53fb..99bdd3b 100644
--- a/modules/lua/libs/xml.c
+++ b/modules/lua/libs/xml.c
@@ -48,29 +48,15 @@ static const luaL_Reg vlclua_xml_reg[] = {
     { NULL, NULL }
 };
 
-static int vlclua_xml_delete( lua_State *L )
-{
-    xml_t *p_xml = *(xml_t**)luaL_checkudata( L, 1, "xml" );
-    xml_Delete( p_xml );
-    return 0;
-}
-
 static int vlclua_xml_create( lua_State *L )
 {
-    xml_t *p_xml = xml_Create( vlclua_get_this( L ) );
-    if( !p_xml )
-        return luaL_error( L, "XML module creation failed." );
-
-    xml_t **pp_xml = lua_newuserdata( L, sizeof( xml_t * ) );
-    *pp_xml = p_xml;
+    lua_newuserdata( L, 0 );
 
     if( luaL_newmetatable( L, "xml" ) )
     {
         lua_newtable( L );
         luaL_register( L, NULL, vlclua_xml_reg );
         lua_setfield( L, -2, "__index" );
-        lua_pushcfunction( L, vlclua_xml_delete );
-        lua_setfield( L, -2, "__gc" );
     }
 
     lua_setmetatable( L, -2 );
@@ -98,10 +84,10 @@ static int vlclua_xml_reader_delete( lua_State *L )
 
 static int vlclua_xml_create_reader( lua_State *L )
 {
-    xml_t *p_xml = *(xml_t**)luaL_checkudata( L, 1, "xml" );
+    vlc_object_t *obj = vlclua_get_this( L );
     stream_t *p_stream = *(stream_t **)luaL_checkudata( L, 2, "stream" );
 
-    xml_reader_t *p_reader = xml_ReaderCreate( p_xml, p_stream );
+    xml_reader_t *p_reader = xml_ReaderCreate( obj, p_stream );
     if( !p_reader )
         return luaL_error( L, "XML reader creation failed." );
 
    
    
More information about the vlc-commits
mailing list