aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-08-05 21:28:06 +0200
committerMax Kellermann <max@duempel.org>2013-08-05 21:28:19 +0200
commitaf63372d2ba4f4b251053c110b4676edf1ea1e7a (patch)
tree0d8b1442693770f17b25aee22fec364792121481
parent3e91f757a9d5d0499cd4605506c39533ca5acdf8 (diff)
downloadmpd-af63372d2ba4f4b251053c110b4676edf1ea1e7a.tar.gz
mpd-af63372d2ba4f4b251053c110b4676edf1ea1e7a.tar.xz
mpd-af63372d2ba4f4b251053c110b4676edf1ea1e7a.zip
playlist/m3u: allocate ExtM3uPlaylist with new/delete
Diffstat (limited to '')
-rw-r--r--src/playlist/M3uPlaylistPlugin.cxx17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/playlist/M3uPlaylistPlugin.cxx b/src/playlist/M3uPlaylistPlugin.cxx
index ee61baa7b..d9f1e4737 100644
--- a/src/playlist/M3uPlaylistPlugin.cxx
+++ b/src/playlist/M3uPlaylistPlugin.cxx
@@ -28,16 +28,18 @@
struct M3uPlaylist {
struct playlist_provider base;
- TextInputStream *tis;
+ TextInputStream tis;
+
+ M3uPlaylist(input_stream *is)
+ :tis(is) {
+ playlist_provider_init(&base, &m3u_playlist_plugin);
+ }
};
static struct playlist_provider *
m3u_open_stream(struct input_stream *is)
{
- M3uPlaylist *playlist = g_new(M3uPlaylist, 1);
-
- playlist_provider_init(&playlist->base, &m3u_playlist_plugin);
- playlist->tis = new TextInputStream(is);
+ M3uPlaylist *playlist = new M3uPlaylist(is);
return &playlist->base;
}
@@ -47,8 +49,7 @@ m3u_close(struct playlist_provider *_playlist)
{
M3uPlaylist *playlist = (M3uPlaylist *)_playlist;
- delete playlist->tis;
- g_free(playlist);
+ delete playlist;
}
static Song *
@@ -59,7 +60,7 @@ m3u_read(struct playlist_provider *_playlist)
const char *line_s;
do {
- if (!playlist->tis->ReadLine(line))
+ if (!playlist->tis.ReadLine(line))
return NULL;
line_s = line.c_str();