[vlc-devel] [PATCH 4/9] dbus: Fix variable naming and use an enum instead of hardcoded indexes

Mirsal Ennaime mirsal at mirsal.fr
Tue Feb 8 22:35:59 CET 2011


From: Mirsal Ennaime <mirsal.ennaime at gmail.com>

---
 modules/control/dbus/dbus.c        |   12 +++++++++---
 modules/control/dbus/dbus_common.h |    2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/modules/control/dbus/dbus.c b/modules/control/dbus/dbus.c
index acae791..ba3a56c 100644
--- a/modules/control/dbus/dbus.c
+++ b/modules/control/dbus/dbus.c
@@ -104,6 +104,12 @@ typedef struct
     DBusTimeout *p_timeout;
 } timeout_info_t;
 
+enum
+{
+    PIPE_OUT = 0,
+    PIPE_IN  = 1
+};
+
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
@@ -147,7 +153,7 @@ static int Open( vlc_object_t *p_this )
     p_sys->p_input = NULL;
     p_sys->i_playing_state = -1;
 
-    if( pipe( p_sys->i_pipe_fds ) )
+    if( pipe( p_sys->p_pipe_fds ) )
     {
         free( p_sys );
         msg_Err( p_intf, "Could not create pipe" );
@@ -451,7 +457,7 @@ static void Run          ( intf_thread_t *p_intf )
         unsigned int i_watches = vlc_array_count( p_sys->p_watches );
         p_fds = (struct pollfd*) calloc( sizeof( struct pollfd ), i_watches );
 
-        p_fds[0].fd = p_sys->i_pipe_fds[0];
+        p_fds[0].fd = p_sys->p_pipe_fds[PIPE_OUT];
         p_fds[0].events = POLLIN | POLLPRI;
 
         int i_fds = 1;
@@ -690,7 +696,7 @@ static void   wakeup_main_loop( void *p_data )
 
     msg_Dbg( p_intf, "Sending wakeup signal to the main loop" );
 
-    if( !write( p_intf->p_sys->i_pipe_fds[1], "\0", 1 ) )
+    if( !write( p_intf->p_sys->p_pipe_fds[PIPE_IN], "\0", 1 ) )
     {
         msg_Err( p_intf,
             "Could not wake up the main loop: %s", strerror( errno ) );
diff --git a/modules/control/dbus/dbus_common.h b/modules/control/dbus/dbus_common.h
index e0354dd..0767edd 100644
--- a/modules/control/dbus/dbus_common.h
+++ b/modules/control/dbus/dbus_common.h
@@ -91,7 +91,7 @@ struct intf_sys_t
     vlc_array_t    *p_events;
     vlc_array_t    *p_timeouts;
     vlc_array_t    *p_watches;
-    int             i_pipe_fds[2];
+    int             p_pipe_fds[2];
     vlc_mutex_t     lock;
     input_thread_t *p_input;
     bool            b_unique;
-- 
1.7.1




More information about the vlc-devel mailing list