aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-08-05 21:25:25 +0200
committerMax Kellermann <max@duempel.org>2013-08-05 21:25:25 +0200
commit3e91f757a9d5d0499cd4605506c39533ca5acdf8 (patch)
tree595c4f7bae8cc48295ad53bb5661d0d8992738b1 /src
parent498491ec051bd298ac3bf0081e5226da3bc9d894 (diff)
downloadmpd-3e91f757a9d5d0499cd4605506c39533ca5acdf8.tar.gz
mpd-3e91f757a9d5d0499cd4605506c39533ca5acdf8.tar.xz
mpd-3e91f757a9d5d0499cd4605506c39533ca5acdf8.zip
playlist/extm3u: allocate ExtM3uPlaylist with new/delete
Diffstat (limited to 'src')
-rw-r--r--src/playlist/ExtM3uPlaylistPlugin.cxx21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/playlist/ExtM3uPlaylistPlugin.cxx b/src/playlist/ExtM3uPlaylistPlugin.cxx
index fc79ba26b..440dcd432 100644
--- a/src/playlist/ExtM3uPlaylistPlugin.cxx
+++ b/src/playlist/ExtM3uPlaylistPlugin.cxx
@@ -33,26 +33,28 @@
struct ExtM3uPlaylist {
struct playlist_provider base;
- TextInputStream *tis;
+ TextInputStream tis;
+
+ ExtM3uPlaylist(input_stream *is)
+ :tis(is) {
+ playlist_provider_init(&base, &extm3u_playlist_plugin);
+ }
};
static struct playlist_provider *
extm3u_open_stream(struct input_stream *is)
{
- ExtM3uPlaylist *playlist = g_new(ExtM3uPlaylist, 1);
- playlist->tis = new TextInputStream(is);
+ ExtM3uPlaylist *playlist = new ExtM3uPlaylist(is);
std::string line;
- if (!playlist->tis->ReadLine(line)
+ if (!playlist->tis.ReadLine(line)
|| strcmp(line.c_str(), "#EXTM3U") != 0) {
/* no EXTM3U header: fall back to the plain m3u
plugin */
- delete playlist->tis;
- g_free(playlist);
+ delete playlist;
return NULL;
}
- playlist_provider_init(&playlist->base, &extm3u_playlist_plugin);
return &playlist->base;
}
@@ -61,8 +63,7 @@ extm3u_close(struct playlist_provider *_playlist)
{
ExtM3uPlaylist *playlist = (ExtM3uPlaylist *)_playlist;
- delete playlist->tis;
- g_free(playlist);
+ delete playlist;
}
/**
@@ -115,7 +116,7 @@ extm3u_read(struct playlist_provider *_playlist)
Song *song;
do {
- if (!playlist->tis->ReadLine(line)) {
+ if (!playlist->tis.ReadLine(line)) {
delete tag;
return NULL;
}