[vlc-devel] [PATCH 3/9] dbus: use int[2] with pipe()
Mirsal Ennaime
mirsal at mirsal.fr
Tue Feb 8 22:35:58 CET 2011
From: Rafaël Carré <rafael.carre at gmail.com>
do not rely on the position of 2 successive ints in the struct
---
modules/control/dbus/dbus.c | 6 +++---
modules/control/dbus/dbus_common.h | 3 +--
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/modules/control/dbus/dbus.c b/modules/control/dbus/dbus.c
index 45b47c9..acae791 100644
--- a/modules/control/dbus/dbus.c
+++ b/modules/control/dbus/dbus.c
@@ -147,7 +147,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_fd_out ) )
+ if( pipe( p_sys->i_pipe_fds ) )
{
free( p_sys );
msg_Err( p_intf, "Could not create pipe" );
@@ -451,7 +451,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_fd_out;
+ p_fds[0].fd = p_sys->i_pipe_fds[0];
p_fds[0].events = POLLIN | POLLPRI;
int i_fds = 1;
@@ -690,7 +690,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_fd_in, "\0", 1 ) )
+ if( !write( p_intf->p_sys->i_pipe_fds[1], "\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 7a4c0de..e0354dd 100644
--- a/modules/control/dbus/dbus_common.h
+++ b/modules/control/dbus/dbus_common.h
@@ -91,8 +91,7 @@ struct intf_sys_t
vlc_array_t *p_events;
vlc_array_t *p_timeouts;
vlc_array_t *p_watches;
- int i_pipe_fd_out;
- int i_pipe_fd_in;
+ int i_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