[vlc-commits] lua/libs/xml: make reader:next_node return whether tag is empty
Filip Roséen
git at videolan.org
Fri Jul 22 11:10:51 CEST 2016
vlc | branch: master | Filip Roséen <filip at videolabs.io> | Wed Jul 20 03:41:04 2016 +0200| [7f9fac4e35fdb7cb907779fead44ab2ff438f199] | committer: Jean-Baptiste Kempf
lua/libs/xml: make reader:next_node return whether tag is empty
ret, tagname, is_empty = reader:next_node()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7f9fac4e35fdb7cb907779fead44ab2ff438f199
---
modules/lua/libs/xml.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/modules/lua/libs/xml.c b/modules/lua/libs/xml.c
index 99bdd3b..874f8ba 100644
--- a/modules/lua/libs/xml.c
+++ b/modules/lua/libs/xml.c
@@ -112,7 +112,9 @@ static int vlclua_xml_reader_next_node( lua_State *L )
xml_reader_t *p_reader = *(xml_reader_t**)luaL_checkudata( L, 1, "xml_reader" );
const char *psz_name;
int i_type = xml_ReaderNextNode( p_reader, &psz_name );
- if( i_type <= 0 )
+ int i_empty = xml_ReaderIsEmptyElement( p_reader );
+
+ if( i_type <= 0 || i_empty < 0 )
{
lua_pushinteger( L, 0 );
return 1;
@@ -120,7 +122,9 @@ static int vlclua_xml_reader_next_node( lua_State *L )
lua_pushinteger( L, i_type );
lua_pushstring( L, psz_name );
- return 2;
+ lua_pushboolean( L, i_empty );
+
+ return 3;
}
static int vlclua_xml_reader_next_attr( lua_State *L )
More information about the vlc-commits
mailing list