Commit bd71d3ea authored by Max Kellermann's avatar Max Kellermann

playlist: return early from shufflePlaylist()

Remove one indent level by returning diretly after the check. This makes the function more readable.
parent 00541f8c
...@@ -997,33 +997,34 @@ void shufflePlaylist(void) ...@@ -997,33 +997,34 @@ void shufflePlaylist(void)
{ {
unsigned i; unsigned i;
if (queue_length(&playlist.queue) > 1) { if (queue_length(&playlist.queue) <= 1)
if (playlist.playing) { return;
if (playlist.queued >= 0)
clearPlayerQueue();
if (playlist.current >= 0)
/* put current playing song first */
swapSongs(0, queue_order_to_position(&playlist.queue,
playlist.current));
if (playlist.queue.random) { if (playlist.playing) {
playlist.current = if (playlist.queued >= 0)
queue_position_to_order(&playlist.queue, 0); clearPlayerQueue();
} else
playlist.current = 0;
i = 1;
} else {
i = 0;
playlist.current = -1;
}
/* shuffle the rest of the list */ if (playlist.current >= 0)
queue_shuffle_range(&playlist.queue, i, /* put current playing song first */
queue_length(&playlist.queue)); swapSongs(0, queue_order_to_position(&playlist.queue,
playlist.current));
incrPlaylistVersion(); if (playlist.queue.random) {
playlist.current =
queue_position_to_order(&playlist.queue, 0);
} else
playlist.current = 0;
i = 1;
} else {
i = 0;
playlist.current = -1;
} }
/* shuffle the rest of the list */
queue_shuffle_range(&playlist.queue, i,
queue_length(&playlist.queue));
incrPlaylistVersion();
} }
enum playlist_result savePlaylist(const char *utf8file) enum playlist_result savePlaylist(const char *utf8file)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment