Playlist: pass max_length to playlist_init()

Move the configuration lookup to Main.cxx.
This commit is contained in:
Max Kellermann 2013-01-04 22:55:11 +01:00
parent 2a9d933a81
commit e89bd30db5
4 changed files with 8 additions and 10 deletions

View File

@ -414,7 +414,8 @@ int mpd_main(int argc, char *argv[])
} }
initPermissions(); initPermissions();
playlist_global_init(); playlist_global_init(config_get_positive(CONF_MAX_PLAYLIST_LENGTH,
DEFAULT_PLAYLIST_MAX_LENGTH));
spl_global_init(); spl_global_init();
#ifdef ENABLE_ARCHIVE #ifdef ENABLE_ARCHIVE
archive_plugin_init_all(); archive_plugin_init_all();

View File

@ -23,7 +23,6 @@
#include "song.h" #include "song.h"
extern "C" { extern "C" {
#include "conf.h"
#include "idle.h" #include "idle.h"
} }
@ -54,11 +53,9 @@ playlist_tag_changed(struct playlist *playlist)
} }
void void
playlist_init(struct playlist *playlist) playlist_init(struct playlist *playlist, unsigned max_length)
{ {
queue_init(&playlist->queue, queue_init(&playlist->queue, max_length);
config_get_positive(CONF_MAX_PLAYLIST_LENGTH,
DEFAULT_PLAYLIST_MAX_LENGTH));
playlist->queued = -1; playlist->queued = -1;
playlist->current = -1; playlist->current = -1;

View File

@ -74,13 +74,13 @@ struct playlist {
extern struct playlist g_playlist; extern struct playlist g_playlist;
void void
playlist_global_init(void); playlist_global_init(unsigned max_length);
void void
playlist_global_finish(void); playlist_global_finish(void);
void void
playlist_init(struct playlist *playlist); playlist_init(struct playlist *playlist, unsigned max_length);
void void
playlist_finish(struct playlist *playlist); playlist_finish(struct playlist *playlist);

View File

@ -45,9 +45,9 @@ playlist_event(void)
} }
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_TAG, playlist_tag_event);
event_pipe_register(PIPE_EVENT_PLAYLIST, playlist_event); event_pipe_register(PIPE_EVENT_PLAYLIST, playlist_event);