aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-04-09 00:34:48 +0200
committerMax Kellermann <max@duempel.org>2013-04-09 00:34:48 +0200
commit3cc7be0fa6ad68fae6f3d1938e2f7f5a2e951454 (patch)
tree9eaec07eedbc9c9fea87c4096fc55e048e53a560 /src
parent6728b8c1a386d82ac15137f82d693559a0d51a8f (diff)
downloadmpd-3cc7be0fa6ad68fae6f3d1938e2f7f5a2e951454.tar.gz
mpd-3cc7be0fa6ad68fae6f3d1938e2f7f5a2e951454.tar.xz
mpd-3cc7be0fa6ad68fae6f3d1938e2f7f5a2e951454.zip
playlist/cue: add constructor/destructor
Diffstat (limited to '')
-rw-r--r--src/playlist/CuePlaylistPlugin.cxx24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/playlist/CuePlaylistPlugin.cxx b/src/playlist/CuePlaylistPlugin.cxx
index 07eb5e243..71ae2261a 100644
--- a/src/playlist/CuePlaylistPlugin.cxx
+++ b/src/playlist/CuePlaylistPlugin.cxx
@@ -42,18 +42,23 @@ struct CuePlaylist {
struct input_stream *is;
struct text_input_stream *tis;
struct cue_parser *parser;
+
+ CuePlaylist(struct input_stream *_is)
+ :is(_is), tis(text_input_stream_new(is)),
+ parser(cue_parser_new()) {
+ playlist_provider_init(&base, &cue_playlist_plugin);
+ }
+
+ ~CuePlaylist() {
+ cue_parser_free(parser);
+ text_input_stream_free(tis);
+ }
};
static struct playlist_provider *
cue_playlist_open_stream(struct input_stream *is)
{
- CuePlaylist *playlist = g_new(CuePlaylist, 1);
- playlist_provider_init(&playlist->base, &cue_playlist_plugin);
-
- playlist->is = is;
- playlist->tis = text_input_stream_new(is);
- playlist->parser = cue_parser_new();
-
+ CuePlaylist *playlist = new CuePlaylist(is);
return &playlist->base;
}
@@ -61,10 +66,7 @@ static void
cue_playlist_close(struct playlist_provider *_playlist)
{
CuePlaylist *playlist = (CuePlaylist *)_playlist;
-
- cue_parser_free(playlist->parser);
- text_input_stream_free(playlist->tis);
- g_free(playlist);
+ delete playlist;
}
static struct song *