[vlc-devel] [PATCH 4/4] input/var: removed useless branching in input_ControlVarStop

Filip Roséen filip at videolabs.io
Sat Jul 16 22:38:28 CEST 2016


Given that the for-loop indirectly checks exactly what the sourrounding
if is checking, there is no need for the outer if; as such this patch
removes it.
---
 src/input/var.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/input/var.c b/src/input/var.c
index cb54d28..3859999 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -236,15 +236,12 @@ void input_ControlVarStop( input_thread_t *p_input )
     if( p_input->p->i_title > 1 )
         InputDelCallbacks( p_input, p_input_title_navigation_callbacks );
 
-    if( p_input->p->i_title > 0 )
+    for( int i = 0; i < p_input->p->i_title; i++ )
     {
-        for( int i = 0; i < p_input->p->i_title; i++ )
-        {
-            char name[sizeof("title ") + 3 * sizeof (int)];
+        char name[sizeof("title ") + 3 * sizeof (int)];
 
-            sprintf( name, "title %2u", i );
-            var_DelCallback( p_input, name, NavigationCallback, (void *)(intptr_t)i );
-        }
+        sprintf( name, "title %2u", i );
+        var_DelCallback( p_input, name, NavigationCallback, (void *)(intptr_t)i );
     }
 
     if( !demux_Control( p_demux, DEMUX_GET_TITLE, &i_cur_title ) )
-- 
2.9.0



More information about the vlc-devel mailing list