aboutsummaryrefslogtreecommitdiffstats
path: root/src/song.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-10-05 18:18:18 -0700
committerEric Wong <normalperson@yhbt.net>2008-10-05 18:25:25 -0700
commitbb1c32af94c42cda454a0ba2a2979626b96b53fd (patch)
tree3813323e9b9cd6450e062b2d2bf5238fc99fcb84 /src/song.c
parent36eba830fc097279f568e801b2d2a35a08004717 (diff)
downloadmpd-bb1c32af94c42cda454a0ba2a2979626b96b53fd.tar.gz
mpd-bb1c32af94c42cda454a0ba2a2979626b96b53fd.tar.xz
mpd-bb1c32af94c42cda454a0ba2a2979626b96b53fd.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 '')
-rw-r--r--src/song.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/song.c b/src/song.c
index e1d8bb1b8..ab98963ad 100644
--- a/src/song.c
+++ b/src/song.c
@@ -29,21 +29,19 @@
#include "os_compat.h"
-static Song *
-song_alloc(const char *url, enum song_type type, Directory *parent)
+static Song * song_alloc(const char *url, Directory *parent)
{
size_t urllen = strlen(url);
Song *song = xmalloc(sizeof(Song) + urllen);
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;
@@ -52,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)) {
InputPlugin *plugin;
unsigned int next = 0;
char path_max_tmp[MPD_PATH_MAX];
@@ -166,8 +162,7 @@ void readSongInfoIntoList(FILE * fp, Directory * parentDir)
if (!prefixcmp(buffer, SONG_KEY)) {
if (song)
insertSongIntoList(sv, song);
- song = song_alloc(buffer + strlen(SONG_KEY),
- SONG_TYPE_FILE, parentDir);
+ song = song_alloc(buffer + strlen(SONG_KEY), parentDir);
} else if (*buffer == 0) {
/* ignore empty lines (starting with '\0') */
} else if (song == NULL) {
@@ -204,7 +199,7 @@ void readSongInfoIntoList(FILE * fp, Directory * parentDir)
int updateSongInfo(Song * song)
{
- if (song->type == SONG_TYPE_FILE) {
+ if (song_is_file(song)) {
InputPlugin *plugin;
unsigned int next = 0;
char path_max_tmp[MPD_PATH_MAX];