[vlc-commits] access/jack: remove unnecessary if-conditions

Filip Roséen git at videolan.org
Wed Oct 12 10:04:40 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Tue Oct 11 20:06:25 2016 +0200| [f4f3b9b0f846c7b6e4255db60b26929700cee8c0] | committer: Thomas Guillem

access/jack: remove unnecessary if-conditions

The if-statement is redundant given that the loop-condition will not
fire unless the former if-condition is true; as such the if-condition
is now removed.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 modules/access/jack.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/modules/access/jack.c b/modules/access/jack.c
index 782965c..694f9c5 100644
--- a/modules/access/jack.c
+++ b/modules/access/jack.c
@@ -245,14 +245,11 @@ static int Open( vlc_object_t *p_this )
    /*  if( var_GetBool( p_demux, "jack-input-auto-connect" ) && p_sys->psz_ports ) */
     if( p_sys->psz_ports )
     {
-        if( p_sys->i_match_ports > 0 )
+        for( int j = 0; j < p_sys->i_match_ports; j++ )
         {
-            for( int j = 0; j < p_sys->i_match_ports; j++ )
-            {
-                int i_input_ports = j % p_sys->i_channels;
-                jack_connect( p_sys->p_jack_client, p_sys->pp_jack_port_table[j],
-                    jack_port_name( p_sys->pp_jack_port_input[i_input_ports] ) );
-            }
+            int i_input_ports = j % p_sys->i_channels;
+            jack_connect( p_sys->p_jack_client, p_sys->pp_jack_port_table[j],
+                jack_port_name( p_sys->pp_jack_port_input[i_input_ports] ) );
         }
     }
 
@@ -266,15 +263,14 @@ static int Open( vlc_object_t *p_this )
         {
             i_out_ports++;
         }
-        if( i_out_ports > 0 )
+
+        for( int j = 0; j < i_out_ports; j++ )
         {
-            for( int j = 0; j < i_out_ports; j++ )
-            {
-                int i_input_ports = j % p_sys->i_channels;
-                jack_connect( p_sys->p_jack_client, pp_jack_port_output[j],
-                    jack_port_name( p_sys->pp_jack_port_input[i_input_ports] ) );
-            }
+            int i_input_ports = j % p_sys->i_channels;
+            jack_connect( p_sys->p_jack_client, pp_jack_port_output[j],
+                jack_port_name( p_sys->pp_jack_port_input[i_input_ports] ) );
         }
+
         free( pp_jack_port_output );
     }
 



More information about the vlc-commits mailing list