[vlc-devel] commit: Cosmetics (Error is not used only on error) (Laurent Aimar )

git version control git at videolan.org
Mon Jul 28 23:38:44 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Jul 28 23:24:53 2008 +0200| [2f05f4753cd0528be9cef8f607ca934216283c0f]

Cosmetics (Error is not used only on error)

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

 src/input/input.c          |   12 ++++++------
 src/input/input_internal.h |   11 ++++++++---
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 7ce4c94..cc5e828 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -59,7 +59,7 @@ static  int RunAndDestroy  ( input_thread_t *p_input );
 static input_thread_t * Create  ( vlc_object_t *, input_item_t *,
                                   const char *, bool, sout_instance_t * );
 static  int             Init    ( input_thread_t *p_input );
-static void             Error   ( input_thread_t *p_input );
+static void             WaitDie   ( input_thread_t *p_input );
 static void             End     ( input_thread_t *p_input );
 static void             MainLoop( input_thread_t *p_input );
 
@@ -494,7 +494,7 @@ static int Run( input_thread_t *p_input )
         /* If we failed, wait before we are killed, and exit */
         p_input->b_error = true;
 
-        Error( p_input );
+        WaitDie( p_input );
 
         /* Tell we're dead */
         p_input->b_dead = true;
@@ -525,7 +525,7 @@ static int Run( input_thread_t *p_input )
     /* Wait until we are asked to die */
     if( !p_input->b_die )
     {
-        Error( p_input );
+        WaitDie( p_input );
     }
 
     /* Clean up */
@@ -1262,13 +1262,13 @@ error:
 }
 
 /*****************************************************************************
- * Error: RunThread() error loop
+ * WaitDie: Wait until we are asked to die.
  *****************************************************************************
  * This function is called when an error occurred during thread main's loop.
  *****************************************************************************/
-static void Error( input_thread_t *p_input )
+static void WaitDie( input_thread_t *p_input )
 {
-    input_ChangeState( p_input, ERROR_S );
+    input_ChangeState( p_input, p_input->b_error ? ERROR_S : END_S );
     while( !p_input->b_die )
     {
         /* Sleep a while */
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 580b4fd..a825e53 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -386,13 +386,18 @@ void MRLSplit( char *, const char **, const char **, char ** );
 
 static inline void input_ChangeStateWithVarCallback( input_thread_t *p_input, int state, bool callback )
 {
-    bool changed = (p_input->i_state != state);
+    const bool changed = p_input->i_state != state;
+
+    p_input->i_state = state;
+
     if( callback )
-        var_SetInteger( p_input, "state", p_input->i_state = state );
+    {
+        var_SetInteger( p_input, "state", state );
+    }
     else
     {
         vlc_value_t val;
-        p_input->i_state = val.i_int = state;
+        val.i_int = state;
         var_Change( p_input, "state", VLC_VAR_SETVALUE, &val, NULL );
     }
     if( changed )




More information about the vlc-devel mailing list