playlist: return early from shufflePlaylist()

Remove one indent level by returning diretly after the check.  This
makes the function more readable.
This commit is contained in:
Max Kellermann 2009-01-23 00:09:29 +01:00
parent 00541f8ce9
commit bd71d3ea78

View File

@ -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) if (playlist.playing) {
/* put current playing song first */ if (playlist.queued >= 0)
swapSongs(0, queue_order_to_position(&playlist.queue, clearPlayerQueue();
playlist.current));
if (playlist.queue.random) { if (playlist.current >= 0)
playlist.current = /* put current playing song first */
queue_position_to_order(&playlist.queue, 0); swapSongs(0, queue_order_to_position(&playlist.queue,
} else playlist.current));
playlist.current = 0;
i = 1;
} else {
i = 0;
playlist.current = -1;
}
/* shuffle the rest of the list */ if (playlist.queue.random) {
queue_shuffle_range(&playlist.queue, i, playlist.current =
queue_length(&playlist.queue)); queue_position_to_order(&playlist.queue, 0);
} else
incrPlaylistVersion(); 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)