diff options
author | Max Kellermann <max@duempel.org> | 2013-04-17 01:21:33 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-04-17 01:21:33 +0200 |
commit | 0954f580fa62ce52bb63739e7624f8b3f97546a6 (patch) | |
tree | 068650ca722aab70f8f0f75970eb0c45f994c8af /src/output/NullOutputPlugin.cxx | |
parent | 3a2254c91f19364d41aacea442c43b00aa1175e2 (diff) | |
download | mpd-0954f580fa62ce52bb63739e7624f8b3f97546a6.tar.gz mpd-0954f580fa62ce52bb63739e7624f8b3f97546a6.tar.xz mpd-0954f580fa62ce52bb63739e7624f8b3f97546a6.zip |
output/oss,null: use new/delete
Diffstat (limited to '')
-rw-r--r-- | src/output/NullOutputPlugin.cxx | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/output/NullOutputPlugin.cxx b/src/output/NullOutputPlugin.cxx index 3596cbdcb..bbcf26c00 100644 --- a/src/output/NullOutputPlugin.cxx +++ b/src/output/NullOutputPlugin.cxx @@ -22,8 +22,6 @@ #include "output_api.h" #include "timer.h" -#include <glib.h> - #include <assert.h> struct NullOutput { @@ -32,16 +30,25 @@ struct NullOutput { bool sync; struct timer *timer; + + bool Initialize(const config_param *param, GError **error_r) { + return ao_base_init(&base, &null_output_plugin, param, + error_r); + } + + void Deinitialize() { + ao_base_finish(&base); + } }; static struct audio_output * -null_init(const struct config_param *param, GError **error_r) +null_init(const config_param *param, GError **error_r) { - NullOutput *nd = g_new(NullOutput, 1); + NullOutput *nd = new NullOutput(); - if (!ao_base_init(&nd->base, &null_output_plugin, param, error_r)) { - g_free(nd); - return NULL; + if (!nd->Initialize(param, error_r)) { + delete nd; + return nullptr; } nd->sync = config_get_block_bool(param, "sync", true); @@ -54,13 +61,13 @@ null_finish(struct audio_output *ao) { NullOutput *nd = (NullOutput *)ao; - ao_base_finish(&nd->base); - g_free(nd); + nd->Deinitialize(); + delete nd; } static bool null_open(struct audio_output *ao, struct audio_format *audio_format, - G_GNUC_UNUSED GError **error) + gcc_unused GError **error) { NullOutput *nd = (NullOutput *)ao; @@ -90,8 +97,8 @@ null_delay(struct audio_output *ao) } static size_t -null_play(struct audio_output *ao, G_GNUC_UNUSED const void *chunk, size_t size, - G_GNUC_UNUSED GError **error) +null_play(struct audio_output *ao, gcc_unused const void *chunk, size_t size, + gcc_unused GError **error) { NullOutput *nd = (NullOutput *)ao; struct timer *timer = nd->timer; |