diff options
author | Max Kellermann <max@duempel.org> | 2011-08-31 20:58:36 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-08-31 20:58:36 +0200 |
commit | 042c1abc6e1b0023a9f2964573102a332e598237 (patch) | |
tree | 4137562c2e5f676ce2f53dd7359e367b4f80bbae | |
parent | 3d12d7de624c734112741bdbe55bcdf818df19ab (diff) | |
download | mpd-042c1abc6e1b0023a9f2964573102a332e598237.tar.gz mpd-042c1abc6e1b0023a9f2964573102a332e598237.tar.xz mpd-042c1abc6e1b0023a9f2964573102a332e598237.zip |
output/pulse: use _delete_context()
Eliminate duplicate code.
-rw-r--r-- | src/output/pulse_output_plugin.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/output/pulse_output_plugin.c b/src/output/pulse_output_plugin.c index babb8e221..c09b6a6af 100644 --- a/src/output/pulse_output_plugin.c +++ b/src/output/pulse_output_plugin.c @@ -225,6 +225,20 @@ pulse_output_connect(struct pulse_output *po, GError **error_r) } /** + * Frees and clears the context. + */ +static void +pulse_output_delete_context(struct pulse_output *po) +{ + assert(po != NULL); + assert(po->context != NULL); + + pa_context_disconnect(po->context); + pa_context_unref(po->context); + po->context = NULL; +} + +/** * Create, set up and connect a context. * * @return true on success, false on error @@ -249,28 +263,13 @@ pulse_output_setup_context(struct pulse_output *po, GError **error_r) pulse_output_subscribe_cb, po); if (!pulse_output_connect(po, error_r)) { - pa_context_unref(po->context); - po->context = NULL; + pulse_output_delete_context(po); return false; } return true; } -/** - * Frees and clears the context. - */ -static void -pulse_output_delete_context(struct pulse_output *po) -{ - assert(po != NULL); - assert(po->context != NULL); - - pa_context_disconnect(po->context); - pa_context_unref(po->context); - po->context = NULL; -} - static void * pulse_output_init(G_GNUC_UNUSED const struct audio_format *audio_format, const struct config_param *param, |