aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-04 22:08:39 +0100
committerMax Kellermann <max@duempel.org>2009-02-04 22:08:39 +0100
commitcbea8a2a00e82ead82fbc3bf968f22c004e80931 (patch)
treec1de833c25a145b4023f6773b40414e5fff6668b
parent080dd095a5113a2454d4a0b050f233befb7eab1a (diff)
downloadmpd-cbea8a2a00e82ead82fbc3bf968f22c004e80931.tar.gz
mpd-cbea8a2a00e82ead82fbc3bf968f22c004e80931.tar.xz
mpd-cbea8a2a00e82ead82fbc3bf968f22c004e80931.zip
playlist: pass const playlist pointers
Pass constant playlist objects to functions which do not modify it.
-rw-r--r--src/playlist.c12
-rw-r--r--src/playlist.h15
2 files changed, 12 insertions, 15 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 12aac3a34..146ef9f0f 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -247,13 +247,13 @@ playPlaylistIfPlayerStopped(struct playlist *playlist)
}
bool
-getPlaylistRepeatStatus(struct playlist *playlist)
+getPlaylistRepeatStatus(const struct playlist *playlist)
{
return playlist->queue.repeat;
}
bool
-getPlaylistRandomStatus(struct playlist *playlist)
+getPlaylistRandomStatus(const struct playlist *playlist)
{
return playlist->queue.random;
}
@@ -323,7 +323,7 @@ void setPlaylistRandomStatus(struct playlist *playlist, bool status)
idle_add(IDLE_OPTIONS);
}
-int getPlaylistCurrentSong(struct playlist *playlist)
+int getPlaylistCurrentSong(const struct playlist *playlist)
{
if (playlist->current >= 0)
return queue_order_to_position(&playlist->queue,
@@ -333,19 +333,19 @@ int getPlaylistCurrentSong(struct playlist *playlist)
}
unsigned long
-getPlaylistVersion(struct playlist *playlist)
+getPlaylistVersion(const struct playlist *playlist)
{
return playlist->queue.version;
}
int
-getPlaylistLength(struct playlist *playlist)
+getPlaylistLength(const struct playlist *playlist)
{
return queue_length(&playlist->queue);
}
unsigned
-getPlaylistSongId(struct playlist *playlist, unsigned song)
+getPlaylistSongId(const struct playlist *playlist, unsigned song)
{
return queue_position_to_id(&playlist->queue, song);
}
diff --git a/src/playlist.h b/src/playlist.h
index 186ac7548..b0e296bc5 100644
--- a/src/playlist.h
+++ b/src/playlist.h
@@ -153,9 +153,6 @@ void previousSongInPlaylist(struct playlist *playlist);
void shufflePlaylist(struct playlist *playlist);
-enum playlist_result
-savePlaylist(struct playlist *playlist, const char *utf8file);
-
void
deleteASongFromPlaylist(struct playlist *playlist, const struct song *song);
@@ -172,24 +169,24 @@ enum playlist_result
swapSongsInPlaylistById(struct playlist *playlist, unsigned id1, unsigned id2);
bool
-getPlaylistRepeatStatus(struct playlist *playlist);
+getPlaylistRepeatStatus(const struct playlist *playlist);
void setPlaylistRepeatStatus(struct playlist *playlist, bool status);
bool
-getPlaylistRandomStatus(struct playlist *playlist);
+getPlaylistRandomStatus(const struct playlist *playlist);
void setPlaylistRandomStatus(struct playlist *playlist, bool status);
-int getPlaylistCurrentSong(struct playlist *playlist);
+int getPlaylistCurrentSong(const struct playlist *playlist);
unsigned
-getPlaylistSongId(struct playlist *playlist, unsigned song);
+getPlaylistSongId(const struct playlist *playlist, unsigned song);
-int getPlaylistLength(struct playlist *playlist);
+int getPlaylistLength(const struct playlist *playlist);
unsigned long
-getPlaylistVersion(struct playlist *playlist);
+getPlaylistVersion(const struct playlist *playlist);
enum playlist_result
seekSongInPlaylist(struct playlist *playlist, unsigned song, float seek_time);