[vlc-devel] [PATCH 1/3] control/dbus: dbus_player: clean PropertiesChangedSignal

Filip Roséen filip at atch.se
Thu May 18 12:02:06 CEST 2017


The return-value of vlc_dictionary_all_keys is a null-terminated array
of the associated keys (on success), meaning that there is no explicit
need to query the count of keys.
---
 modules/control/dbus/dbus_player.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/modules/control/dbus/dbus_player.c b/modules/control/dbus/dbus_player.c
index f7fe6849bd..cb1e75fe57 100644
--- a/modules/control/dbus/dbus_player.c
+++ b/modules/control/dbus/dbus_player.c
@@ -782,7 +782,6 @@ PropertiesChangedSignal( intf_thread_t    *p_intf,
     DBusMessageIter changed_properties, invalidated_properties;
     const char *psz_interface_name = DBUS_MPRIS_PLAYER_INTERFACE;
     char **ppsz_properties = NULL;
-    int i_properties = 0;
 
     SIGNAL_INIT( DBUS_INTERFACE_PROPERTIES,
                  DBUS_MPRIS_OBJECT_PATH,
@@ -795,7 +794,6 @@ PropertiesChangedSignal( intf_thread_t    *p_intf,
                                            &changed_properties ) )
         return DBUS_HANDLER_RESULT_NEED_MEMORY;
 
-    i_properties = vlc_dictionary_keys_count( p_changed_properties );
     ppsz_properties = vlc_dictionary_all_keys( p_changed_properties );
 
     if( unlikely(!ppsz_properties) )
@@ -804,7 +802,7 @@ PropertiesChangedSignal( intf_thread_t    *p_intf,
         return DBUS_HANDLER_RESULT_NEED_MEMORY;
     }
 
-    for( int i = 0; i < i_properties; i++ )
+    for( int i = 0; ppsz_properties[i]; i++ )
     {
         PROPERTY_MAPPING_BEGIN
         PROPERTY_ENTRY( Metadata,       "a{sv}" )
-- 
2.12.2


More information about the vlc-devel mailing list