aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:17 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:27:17 +0200
commita9f0d85115643b61fd8380b8c21e456feed57e17 (patch)
tree54e7a43dc1b2541b4d1ce9fc3b3f88fcda94e7cc /src
parent2a06e2dafaf9889ad111300e09e922b0dacfdbda (diff)
downloadmpd-a9f0d85115643b61fd8380b8c21e456feed57e17.tar.gz
mpd-a9f0d85115643b61fd8380b8c21e456feed57e17.tar.xz
mpd-a9f0d85115643b61fd8380b8c21e456feed57e17.zip
merge the playlist lock functions into clearPlayerQueue()
There is no unlocked caller of clearPlayerQueue(), and the functions lockPlaylistInteraction() and unlockPlaylistInteraction() are trivial - merge them.
Diffstat (limited to '')
-rw-r--r--src/playlist.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 3108ba9f2..623d122ba 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -536,22 +536,14 @@ static void syncPlaylistWithQueue(int queue)
}
}
-static void lockPlaylistInteraction(void)
+static void clearPlayerQueue(void)
{
if (getPlayerQueueState() == PLAYER_QUEUE_PLAY ||
getPlayerQueueState() == PLAYER_QUEUE_FULL) {
playerQueueLock();
syncPlaylistWithQueue(0);
}
-}
-
-static void unlockPlaylistInteraction(void)
-{
- playerQueueUnlock();
-}
-static void clearPlayerQueue(void)
-{
playlist.queued = -1;
switch (getPlayerQueueState()) {
case PLAYER_QUEUE_BLANK:
@@ -569,13 +561,8 @@ static void clearPlayerQueue(void)
setQueueState(PLAYER_QUEUE_STOP);
break;
}
-}
-static void clearPlayerQueueLocked(void)
-{
- lockPlaylistInteraction();
- clearPlayerQueue();
- unlockPlaylistInteraction();
+ playerQueueUnlock();
}
int addToPlaylist(int fd, char *url, int *added_id)
@@ -637,7 +624,7 @@ int addSongToPlaylist(int fd, Song * song, int *added_id)
if (playlist_state == PLAYLIST_STATE_PLAY) {
if (playlist.queued >= 0
&& playlist.current == playlist.length - 1)
- clearPlayerQueueLocked();
+ clearPlayerQueue();
}
id = getNextId();
@@ -697,7 +684,7 @@ int swapSongsInPlaylist(int fd, int song1, int song2)
if (queuedSong == song1 || queuedSong == song2
|| currentSong == song1 || currentSong == song2)
- clearPlayerQueueLocked();
+ clearPlayerQueue();
}
swapSongs(song1, song2);
@@ -757,7 +744,7 @@ int deleteFromPlaylist(int fd, int song)
if (playlist.queued >= 0
&& (playlist.order[playlist.queued] == song
|| playlist.order[playlist.current] == song))
- clearPlayerQueueLocked();
+ clearPlayerQueue();
}
if (playlist.songs[song]->type == SONG_TYPE_URL) {
@@ -1034,7 +1021,7 @@ int setPlaylistRepeatStatus(int fd, int status)
if (playlist_state == PLAYLIST_STATE_PLAY) {
if (playlist.repeat && !status && playlist.queued == 0)
- clearPlayerQueueLocked();
+ clearPlayerQueue();
}
playlist.repeat = status;
@@ -1084,7 +1071,7 @@ int moveSongInPlaylist(int fd, int from, int to)
queuedSong = playlist.order[playlist.queued];
if (queuedSong == from || queuedSong == to
|| currentSong == from || currentSong == to)
- clearPlayerQueueLocked();
+ clearPlayerQueue();
}
tmpSong = playlist.songs[from];
@@ -1158,7 +1145,7 @@ static void orderPlaylist(void)
if (playlist_state == PLAYLIST_STATE_PLAY) {
if (playlist.queued >= 0)
- clearPlayerQueueLocked();
+ clearPlayerQueue();
}
for (i = 0; i < playlist.length; i++) {
@@ -1183,7 +1170,7 @@ static void randomizeOrder(int start, int end)
if (playlist_state == PLAYLIST_STATE_PLAY) {
if (playlist.queued >= start && playlist.queued <= end)
- clearPlayerQueueLocked();
+ clearPlayerQueue();
}
for (i = start; i <= end; i++) {
@@ -1258,7 +1245,7 @@ int shufflePlaylist(mpd_unused int fd)
if (playlist.length > 1) {
if (playlist_state == PLAYLIST_STATE_PLAY) {
- clearPlayerQueueLocked();
+ clearPlayerQueue();
/* put current playing song first */
swapSongs(0, playlist.order[playlist.current]);
if (playlist.random) {
@@ -1385,7 +1372,7 @@ int seekSongInPlaylist(int fd, int song, float seek_time)
if (playlist_state == PLAYLIST_STATE_PLAY) {
if (playlist.queued >= 0)
- clearPlayerQueueLocked();
+ clearPlayerQueue();
} else
playPlaylistOrderNumber(i);