aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-23 00:09:29 +0100
committerMax Kellermann <max@duempel.org>2009-01-23 00:09:29 +0100
commitbd71d3ea78c23c9d344208c823e21cb7f900ba97 (patch)
tree7cc4e5cbcf571c6ee9c201810c2bb6f8a2eb773b /src
parent00541f8ce9304039eb6a54539669aa55d1042339 (diff)
downloadmpd-bd71d3ea78c23c9d344208c823e21cb7f900ba97.tar.gz
mpd-bd71d3ea78c23c9d344208c823e21cb7f900ba97.tar.xz
mpd-bd71d3ea78c23c9d344208c823e21cb7f900ba97.zip
playlist: return early from shufflePlaylist()
Remove one indent level by returning diretly after the check. This makes the function more readable.
Diffstat (limited to '')
-rw-r--r--src/playlist.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 958b6fe14..3b370f9fe 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -997,33 +997,34 @@ void shufflePlaylist(void)
{
unsigned i;
- if (queue_length(&playlist.queue) > 1) {
- if (playlist.playing) {
- 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 (queue_length(&playlist.queue) <= 1)
+ return;
- 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;
- }
+ if (playlist.playing) {
+ if (playlist.queued >= 0)
+ clearPlayerQueue();
- /* shuffle the rest of the list */
- queue_shuffle_range(&playlist.queue, i,
- queue_length(&playlist.queue));
+ if (playlist.current >= 0)
+ /* put current playing song first */
+ 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)