aboutsummaryrefslogtreecommitdiffstats
path: root/src/song.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-10-06 18:52:13 +0200
committerMax Kellermann <max@duempel.org>2008-10-06 18:52:13 +0200
commitf1c53fe0eda77bf126d837c0fb93ffcfb1fc9aea (patch)
tree47a2c85685dbf09cc4c1f44f66f8afd11c0daa84 /src/song.c
parent22e40b61cc0166dcda15b7146724928368201b07 (diff)
downloadmpd-f1c53fe0eda77bf126d837c0fb93ffcfb1fc9aea.tar.gz
mpd-f1c53fe0eda77bf126d837c0fb93ffcfb1fc9aea.tar.xz
mpd-f1c53fe0eda77bf126d837c0fb93ffcfb1fc9aea.zip
song: stop storing song_type
We already know if a song is a URL or not based on whether it has parentDir defined or not. Hopefully one day in the future we can drop HTTP support from MPD entirely when an HTTP filesystem comes along and we can access streams via open(2).
Diffstat (limited to 'src/song.c')
-rw-r--r--src/song.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/song.c b/src/song.c
index 6d689c5c8..54e9ea7e0 100644
--- a/src/song.c
+++ b/src/song.c
@@ -29,20 +29,19 @@
#include "os_compat.h"
Song *
-song_alloc(const char *url, enum song_type type, struct _Directory *parent)
+song_alloc(const char *url, struct _Directory *parent)
{
size_t urllen = strlen(url);
Song *song = xmalloc(sizeof(*song) - sizeof(song->url) + urllen + 1);
song->tag = NULL;
memcpy(song->url, url, urllen + 1);
- song->type = type;
song->parentDir = parent;
return song;
}
-Song *newSong(const char *url, enum song_type type, Directory * parentDir)
+Song *newSong(const char *url, Directory * parentDir)
{
Song *song;
@@ -51,11 +50,9 @@ Song *newSong(const char *url, enum song_type type, Directory * parentDir)
return NULL;
}
- song = song_alloc(url, type, parentDir);
+ song = song_alloc(url, parentDir);
- assert(type == SONG_TYPE_URL || parentDir);
-
- if (song->type == SONG_TYPE_FILE) {
+ if (song_is_file(song)) {
struct decoder_plugin *plugin;
unsigned int next = 0;
char path_max_tmp[MPD_PATH_MAX];
@@ -91,7 +88,7 @@ void freeJustSong(Song * song)
int updateSongInfo(Song * song)
{
- if (song->type == SONG_TYPE_FILE) {
+ if (song_is_file(song)) {
struct decoder_plugin *plugin;
unsigned int next = 0;
char path_max_tmp[MPD_PATH_MAX];