aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-08 11:05:38 +0200
committerEric Wong <normalperson@yhbt.net>2008-10-11 19:21:48 -0700
commite4ca5f5b5c051f98b90070303a83f53b68851034 (patch)
tree434e5b0ae2cb3f2755361eb5515137f7a4b0712d /src
parente6f87010949c1d659b27c5db5707e23230d3eaf0 (diff)
downloadmpd-e4ca5f5b5c051f98b90070303a83f53b68851034.tar.gz
mpd-e4ca5f5b5c051f98b90070303a83f53b68851034.tar.xz
mpd-e4ca5f5b5c051f98b90070303a83f53b68851034.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.
Diffstat (limited to 'src')
-rw-r--r--src/song.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/song.c b/src/song.c
index 5803d4f97..f76c1e4d9 100644
--- a/src/song.c
+++ b/src/song.c
@@ -216,31 +216,31 @@ void readSongInfoIntoList(FILE * fp, struct directory * parent)
int song_file_update(struct mpd_song * song)
{
- if (song_is_file(song)) {
- InputPlugin *plugin;
- unsigned int next = 0;
- char path_max_tmp[MPD_PATH_MAX];
- char abs_path[MPD_PATH_MAX];
- struct mpd_tag *old_tag = song->tag;
- struct mpd_tag *new_tag = NULL;
-
- utf8_to_fs_charset(abs_path, song_get_url(song, path_max_tmp));
- rmp2amp_r(abs_path, abs_path);
-
- while ((plugin = isMusic(abs_path, &song->mtime, next++))) {
- if ((new_tag = plugin->tagDupFunc(abs_path)))
- break;
- }
- if (new_tag && tag_equal(new_tag, old_tag)) {
- tag_free(new_tag);
- } else {
- song->tag = new_tag;
- if (old_tag)
- tag_free(old_tag);
- }
- if (!song->tag || song->tag->time < 0)
- return -1;
+ InputPlugin *plugin;
+ unsigned int next = 0;
+ char path_max_tmp[MPD_PATH_MAX];
+ char abs_path[MPD_PATH_MAX];
+ struct mpd_tag *old_tag = song->tag;
+ struct mpd_tag *new_tag = NULL;
+
+ assert(song_is_file(song));
+
+ utf8_to_fs_charset(abs_path, song_get_url(song, path_max_tmp));
+ rmp2amp_r(abs_path, abs_path);
+
+ while ((plugin = isMusic(abs_path, &song->mtime, next++))) {
+ if ((new_tag = plugin->tagDupFunc(abs_path)))
+ break;
+ }
+ if (new_tag && tag_equal(new_tag, old_tag)) {
+ tag_free(new_tag);
+ } else {
+ song->tag = new_tag;
+ if (old_tag)
+ tag_free(old_tag);
}
+ if (!song->tag || song->tag->time < 0)
+ return -1;
return 0;
}