aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-08 11:05:02 +0200
committerMax Kellermann <max@duempel.org>2008-10-08 11:05:02 +0200
commit4a510a26744a78696f0c69713bf3b05881175fef (patch)
tree5dd66ecbaf8aba1f038c04445ffbaa8a19f05677 /src/playlist.c
parentb084bc28ede5d397e88a4e2bdad8c07a55069589 (diff)
downloadmpd-4a510a26744a78696f0c69713bf3b05881175fef.tar.gz
mpd-4a510a26744a78696f0c69713bf3b05881175fef.tar.xz
mpd-4a510a26744a78696f0c69713bf3b05881175fef.zip
playlist: simplified setPlaylistRandomStatus()
Check the old status before assigning. This saves a temporary variable.
Diffstat (limited to 'src/playlist.c')
-rw-r--r--src/playlist.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 402b57ea3..624636c0c 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -1152,25 +1152,24 @@ static void randomizeOrder(int start, int end)
void setPlaylistRandomStatus(bool status)
{
- bool statusWas = playlist.random;
+ if (status == playlist.random)
+ return;
playlist.random = status;
- if (status != statusWas) {
- if (playlist.random) {
- /*if(playlist_state==PLAYLIST_STATE_PLAY) {
- randomizeOrder(playlist.current+1,
- playlist.length-1);
- }
- else */ randomizeOrder(0, playlist.length - 1);
- if (playlist.current >= 0 &&
- playlist.current < playlist.length) {
- swapOrder(playlist.current, 0);
- playlist.current = 0;
- }
- } else
- orderPlaylist();
- }
+ if (playlist.random) {
+ /*if(playlist_state==PLAYLIST_STATE_PLAY) {
+ randomizeOrder(playlist.current+1,
+ playlist.length-1);
+ }
+ else */ randomizeOrder(0, playlist.length - 1);
+ if (playlist.current >= 0 &&
+ playlist.current < playlist.length) {
+ swapOrder(playlist.current, 0);
+ playlist.current = 0;
+ }
+ } else
+ orderPlaylist();
}
void previousSongInPlaylist(void)