[vlc-commits] Events: simple code cosmetics change

Jean-Baptiste Kempf git at videolan.org
Wed Apr 23 19:30:59 CEST 2014


npapi-vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Apr 23 19:30:39 2014 +0200| [3d0d42485090037181f0bd22f1e75c8b229c373d] | committer: Jean-Baptiste Kempf

Events: simple code cosmetics change

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

 npapi/events.cpp |   32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/npapi/events.cpp b/npapi/events.cpp
index ad988de..e8b8164 100644
--- a/npapi/events.cpp
+++ b/npapi/events.cpp
@@ -226,31 +226,31 @@ bool EventObj::remove(const NPString &name, NPObject *listener, bool bubble)
 
 void EventObj::hook_manager( libvlc_event_manager_t *em, void *userdata )
 {
+    if( !em )
+        return;
+
     _em = em;
 
-    if( _em )
+    /* attach all libvlc events we need */
+    for( size_t i = 0; i < ARRAY_SIZE(vlcevents); i++ )
     {
-        /* attach all libvlc events we care about */
-        for( size_t i = 0; i < ARRAY_SIZE(vlcevents); i++ )
-        {
-            libvlc_event_attach( _em, vlcevents[i].libvlc_type,
-                                      vlcevents[i].libvlc_callback,
-                                      userdata );
-        }
+        libvlc_event_attach( _em, vlcevents[i].libvlc_type,
+                vlcevents[i].libvlc_callback,
+                userdata );
     }
 }
 
 void EventObj::unhook_manager( void *userdata )
 {
-    if( _em )
+    if( !_em )
+        return;
+
+    /* detach all libvlc events */
+    for( size_t i = 0; i < ARRAY_SIZE(vlcevents); i++ )
     {
-        /* detach all libvlc events we cared about */
-        for( size_t i = 0; i < ARRAY_SIZE(vlcevents); i++ )
-        {
-            libvlc_event_detach( _em, vlcevents[i].libvlc_type,
-                                      vlcevents[i].libvlc_callback,
-                                      userdata );
-        }
+        libvlc_event_detach( _em, vlcevents[i].libvlc_type,
+                vlcevents[i].libvlc_callback,
+                userdata );
     }
 }
 



More information about the vlc-commits mailing list