aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-23 06:40:52 +0100
committerMax Kellermann <max@duempel.org>2009-01-23 11:33:03 +0100
commitb5abc023797da97fbd8c2af737f38d0c2fd07edc (patch)
tree8b85e04ca19b88451a8d056f9326d19fc34e5903 /src/playlist.c
parentcfbafbefdce5b18ac59c81d09f8d229630b6dbcd (diff)
downloadmpd-b5abc023797da97fbd8c2af737f38d0c2fd07edc.tar.gz
mpd-b5abc023797da97fbd8c2af737f38d0c2fd07edc.tar.xz
mpd-b5abc023797da97fbd8c2af737f38d0c2fd07edc.zip
playlist: assert in playPlaylistIfPlayerStopped()
The function playPlaylistIfPlayerStopped() is only called when the player thread is stopped. Converted that runtime check into an assertion, and remove one indent level.
Diffstat (limited to '')
-rw-r--r--src/playlist.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 00341ce06..2c6728923 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -783,23 +783,23 @@ void nextSongInPlaylist(void)
static void playPlaylistIfPlayerStopped(void)
{
- if (getPlayerState() == PLAYER_STATE_STOP) {
- enum player_error error = getPlayerError();
+ enum player_error error;
- if (error == PLAYER_ERROR_NOERROR)
- playlist_errorCount = 0;
- else
- playlist_errorCount++;
+ assert(playlist.playing);
+ assert(getPlayerState() == PLAYER_STATE_STOP);
- if (playlist.playing
- && ((playlist_stopOnError && error != PLAYER_ERROR_NOERROR)
- || error == PLAYER_ERROR_AUDIO
- || error == PLAYER_ERROR_SYSTEM
- || playlist_errorCount >= queue_length(&playlist.queue))) {
- stopPlaylist();
- } else
- nextSongInPlaylist();
- }
+ error = getPlayerError();
+ if (error == PLAYER_ERROR_NOERROR)
+ playlist_errorCount = 0;
+ else
+ playlist_errorCount++;
+
+ if ((playlist_stopOnError && error != PLAYER_ERROR_NOERROR) ||
+ error == PLAYER_ERROR_AUDIO || error == PLAYER_ERROR_SYSTEM ||
+ playlist_errorCount >= queue_length(&playlist.queue))
+ stopPlaylist();
+ else
+ nextSongInPlaylist();
}
bool getPlaylistRepeatStatus(void)