Commit 6dbacc71 authored by J. Alexander Treuman's avatar J. Alexander Treuman

Make getBoolConfigParam and save_absolute_paths_in_playlist less stupid

git-svn-id: https://svn.musicpd.org/mpd/trunk@4419 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent ac7ef037
...@@ -372,7 +372,7 @@ int getBoolConfigParam(char *name) ...@@ -372,7 +372,7 @@ int getBoolConfigParam(char *name)
if (strcmp("yes", param->value) == 0) return 1; if (strcmp("yes", param->value) == 0) return 1;
else if (strcmp("no", param->value) == 0) return 0; else if (strcmp("no", param->value) == 0) return 0;
return -1; return -2;
} }
BlockParam *getBlockParam(ConfigParam * param, char *name) BlockParam *getBlockParam(ConfigParam * param, char *name)
......
...@@ -167,7 +167,14 @@ void initPlaylist(void) ...@@ -167,7 +167,14 @@ void initPlaylist(void)
} }
playlist_saveAbsolutePaths = getBoolConfigParam(CONF_SAVE_ABSOLUTE_PATHS); playlist_saveAbsolutePaths = getBoolConfigParam(CONF_SAVE_ABSOLUTE_PATHS);
playlist_saveAbsolutePaths = playlist_saveAbsolutePaths < 0 ? 0 : playlist_saveAbsolutePaths; if (playlist_saveAbsolutePaths == -1) playlist_saveAbsolutePaths = 0;
else if (playlist_saveAbsolutePaths < 0) {
param = getConfigParam(CONF_SAVE_ABSOLUTE_PATHS);
ERROR("%s is not \"yes\" or \"no\" on line %i\n"
CONF_SAVE_ABSOLUTE_PATHS,
param->value, param->line);
exit(EXIT_FAILURE);
}
playlist.songs = malloc(sizeof(Song *) * playlist_max_length); playlist.songs = malloc(sizeof(Song *) * playlist_max_length);
playlist.songMod = malloc(sizeof(mpd_uint32) * playlist_max_length); playlist.songMod = malloc(sizeof(mpd_uint32) * playlist_max_length);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment