]> git.sesse.net Git - vlc/commitdiff
Cosmetics (Error is not used only on error)
authorLaurent Aimar <fenrir@videolan.org>
Mon, 28 Jul 2008 21:24:53 +0000 (23:24 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Mon, 28 Jul 2008 21:24:53 +0000 (23:24 +0200)
src/input/input.c
src/input/input_internal.h

index 7ce4c94136684629ad0c8823e1f4c36357ecb032..cc5e82813212de27d1785821d6f8537a86a7bc99 100644 (file)
@@ -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 */
index 580b4fd79241153bf630a7a20ad8f90bd845bd7b..a825e538d4e4e1363ac0b12ecaa4075c2e93e1b4 100644 (file)
@@ -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 )