[vlc-commits] lib: simplify set_relative_playlist_position_and_play()

Rémi Denis-Courmont git at videolan.org
Wed Aug 5 20:31:26 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Aug  5 19:22:17 2015 +0300| [5c573b07acbfffe495f1afbfe649f97ca0e8cb23] | committer: Rémi Denis-Courmont

lib: simplify set_relative_playlist_position_and_play()

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

 lib/media_list_player.c |   25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/lib/media_list_player.c b/lib/media_list_player.c
index 4a8e863..f570c2b 100644
--- a/lib/media_list_player.c
+++ b/lib/media_list_player.c
@@ -733,25 +733,18 @@ static int set_relative_playlist_position_and_play(
     {
         bool b_loop = (p_mlp->e_playback_mode == libvlc_playback_mode_loop);
 
-        if(i_relative_position > 0)
+        while (i_relative_position > 0)
         {
-            do
-            {
-                path = get_next_path(p_mlp, b_loop);
-                set_current_playing_item(p_mlp, path);
-                --i_relative_position;
-            }
-            while(i_relative_position > 0);
+            path = get_next_path(p_mlp, b_loop);
+            set_current_playing_item(p_mlp, path);
+            --i_relative_position;
         }
-        else if(i_relative_position < 0)
+
+        while (i_relative_position < 0)
         {
-            do
-            {
-                path = get_previous_path(p_mlp, b_loop);
-                set_current_playing_item(p_mlp, path);
-                ++i_relative_position;
-            }
-            while (i_relative_position < 0);
+            path = get_previous_path(p_mlp, b_loop);
+            set_current_playing_item(p_mlp, path);
+            ++i_relative_position;
         }
     }
     else



More information about the vlc-commits mailing list