[vlc-commits] control/dbus: dbus_player: clean PropertiesChangedSignal

Filip Roséen git at videolan.org
Thu May 18 18:08:26 CEST 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Thu May 18 12:02:06 2017 +0200| [a8a4b7fb0ff23db9a14e8b8d63b8fc1fe60292a4] | committer: Rémi Denis-Courmont

control/dbus: dbus_player: clean PropertiesChangedSignal

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.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 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}" )



More information about the vlc-commits mailing list