From e89bd30db56c282c9c97d3d02c01155e7d8daa80 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 4 Jan 2013 22:55:11 +0100 Subject: Playlist: pass max_length to playlist_init() Move the configuration lookup to Main.cxx. --- src/Main.cxx | 3 ++- src/Playlist.cxx | 7 ++----- src/Playlist.hxx | 4 ++-- src/PlaylistGlobal.cxx | 4 ++-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Main.cxx b/src/Main.cxx index b4b5cbb8e..7f56d83a4 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -414,7 +414,8 @@ int mpd_main(int argc, char *argv[]) } initPermissions(); - playlist_global_init(); + playlist_global_init(config_get_positive(CONF_MAX_PLAYLIST_LENGTH, + DEFAULT_PLAYLIST_MAX_LENGTH)); spl_global_init(); #ifdef ENABLE_ARCHIVE archive_plugin_init_all(); diff --git a/src/Playlist.cxx b/src/Playlist.cxx index 9f08439a0..f89a7e31a 100644 --- a/src/Playlist.cxx +++ b/src/Playlist.cxx @@ -23,7 +23,6 @@ #include "song.h" extern "C" { -#include "conf.h" #include "idle.h" } @@ -54,11 +53,9 @@ playlist_tag_changed(struct playlist *playlist) } void -playlist_init(struct playlist *playlist) +playlist_init(struct playlist *playlist, unsigned max_length) { - queue_init(&playlist->queue, - config_get_positive(CONF_MAX_PLAYLIST_LENGTH, - DEFAULT_PLAYLIST_MAX_LENGTH)); + queue_init(&playlist->queue, max_length); playlist->queued = -1; playlist->current = -1; diff --git a/src/Playlist.hxx b/src/Playlist.hxx index 3bbb112b7..3256f6422 100644 --- a/src/Playlist.hxx +++ b/src/Playlist.hxx @@ -74,13 +74,13 @@ struct playlist { extern struct playlist g_playlist; void -playlist_global_init(void); +playlist_global_init(unsigned max_length); void playlist_global_finish(void); void -playlist_init(struct playlist *playlist); +playlist_init(struct playlist *playlist, unsigned max_length); void playlist_finish(struct playlist *playlist); diff --git a/src/PlaylistGlobal.cxx b/src/PlaylistGlobal.cxx index 91c571b6f..d9685a2be 100644 --- a/src/PlaylistGlobal.cxx +++ b/src/PlaylistGlobal.cxx @@ -45,9 +45,9 @@ playlist_event(void) } void -playlist_global_init(void) +playlist_global_init(unsigned max_length) { - playlist_init(&g_playlist); + playlist_init(&g_playlist, max_length); event_pipe_register(PIPE_EVENT_TAG, playlist_tag_event); event_pipe_register(PIPE_EVENT_PLAYLIST, playlist_event); -- cgit v1.2.3