diff options
author | Max Kellermann <max@duempel.org> | 2009-01-21 08:48:02 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-21 08:48:02 +0100 |
commit | 2362ee4a4897502b3ccedf7af31d6d1ad89cff8e (patch) | |
tree | 4e2ddac0c1935356041947304c1ff99a2044879e /src/playlist.c | |
parent | f11eb14c8a7d0134ff5399e1c38777ad7938459a (diff) | |
download | mpd-2362ee4a4897502b3ccedf7af31d6d1ad89cff8e.tar.gz mpd-2362ee4a4897502b3ccedf7af31d6d1ad89cff8e.tar.xz mpd-2362ee4a4897502b3ccedf7af31d6d1ad89cff8e.zip |
use config_get_positive() instead of manual parsing
Simplify some code by using config_get_positive(), instead of doing
manual parsing and validation each time.
Diffstat (limited to '')
-rw-r--r-- | src/playlist.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/playlist.c b/src/playlist.c index 72973610c..063d06843 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -71,7 +71,7 @@ static GRand *g_rand; static Playlist playlist; static int playlist_state = PLAYLIST_STATE_STOP; -unsigned playlist_max_length = DEFAULT_PLAYLIST_MAX_LENGTH; +unsigned playlist_max_length; static int playlist_stopOnError; static unsigned playlist_errorCount; static int playlist_noGoToNext; @@ -135,9 +135,6 @@ playlist_tag_event(void) void initPlaylist(void) { - char *test; - struct config_param *param; - g_rand = g_rand_new(); playlist.length = 0; @@ -147,14 +144,8 @@ void initPlaylist(void) playlist.queued = -1; playlist.current = -1; - param = config_get_param(CONF_MAX_PLAYLIST_LENGTH); - - if (param) { - playlist_max_length = strtol(param->value, &test, 10); - if (*test != '\0') - g_error("max playlist length \"%s\" is not an integer, " - "line %i", param->value, param->line); - } + playlist_max_length = config_get_positive(CONF_MAX_PLAYLIST_LENGTH, + DEFAULT_PLAYLIST_MAX_LENGTH); playlist_saveAbsolutePaths = config_get_bool(CONF_SAVE_ABSOLUTE_PATHS, |