From 1f9b614850f6e350d1c94021fe3723e918f1d259 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 Oct 2008 11:05:38 +0200 Subject: song: don't check song_is_file() in song_file_update() This function was never used on remote songs. Replace the runtime check with an assertion. --- src/song.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/song.c b/src/song.c index 71fa80e7f..44aba9736 100644 --- a/src/song.c +++ b/src/song.c @@ -100,29 +100,28 @@ song_free(struct song *song) int song_file_update(struct song *song) { - if (song_is_file(song)) { - struct decoder_plugin *plugin; - unsigned int next = 0; - char path_max_tmp[MPD_PATH_MAX]; - char abs_path[MPD_PATH_MAX]; + struct decoder_plugin *plugin; + unsigned int next = 0; + char path_max_tmp[MPD_PATH_MAX]; + char abs_path[MPD_PATH_MAX]; - utf8_to_fs_charset(abs_path, song_get_url(song, path_max_tmp)); - rmp2amp_r(abs_path, abs_path); + assert(song_is_file(song)); - if (song->tag) - tag_free(song->tag); + utf8_to_fs_charset(abs_path, song_get_url(song, path_max_tmp)); + rmp2amp_r(abs_path, abs_path); + if (song->tag != NULL) { + tag_free(song->tag); song->tag = NULL; - - while (!song->tag && (plugin = isMusic(abs_path, - &(song->mtime), - next++))) { - song->tag = plugin->tag_dup(abs_path); - } - if (!song->tag || song->tag->time < 0) - return -1; } + while (song->tag == NULL && + (plugin = isMusic(abs_path, &(song->mtime), next++))) + song->tag = plugin->tag_dup(abs_path); + + if (song->tag == NULL || song->tag->time < 0) + return -1; + return 0; } -- cgit v1.2.3