diff options
author | Max Kellermann <max@duempel.org> | 2008-10-08 11:05:38 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-08 11:05:38 +0200 |
commit | 1f9b614850f6e350d1c94021fe3723e918f1d259 (patch) | |
tree | a2d1a8e9361e329b8704596bb07ff0b484c8946c | |
parent | 5e7b18f87458b3f7a65d23d87f7db3d864fbbf11 (diff) | |
download | mpd-1f9b614850f6e350d1c94021fe3723e918f1d259.tar.gz mpd-1f9b614850f6e350d1c94021fe3723e918f1d259.tar.xz mpd-1f9b614850f6e350d1c94021fe3723e918f1d259.zip |
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.
-rw-r--r-- | src/song.c | 33 |
1 files changed, 16 insertions, 17 deletions
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; } |