[retro-gtk/runner-cleanup: 1/4] pa-player: Use g_clear_pointer()
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk/runner-cleanup: 1/4] pa-player: Use g_clear_pointer()
- Date: Sat, 23 May 2020 11:27:52 +0000 (UTC)
commit 7d149cb9d9ca2ab2210046e2e254fc6400b336bc
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sat May 23 11:21:36 2020 +0200
pa-player: Use g_clear_pointer()
This makes the code more concise.
retro-runner/retro-pa-player.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
---
diff --git a/retro-runner/retro-pa-player.c b/retro-runner/retro-pa-player.c
index 6f553c3..175975b 100644
--- a/retro-runner/retro-pa-player.c
+++ b/retro-runner/retro-pa-player.c
@@ -31,12 +31,7 @@ retro_pa_player_finalize (GObject *object)
RetroPaPlayer *self = (RetroPaPlayer *)object;
g_clear_object (&self->core);
-
- if (self->simple != NULL) {
- pa_simple_free (self->simple);
- self->simple = NULL;
- }
-
+ g_clear_pointer (&self->simple, pa_simple_free);
g_clear_pointer (&self->src, src_delete);
g_array_unref (self->buffer);
@@ -77,9 +72,7 @@ prepare_for_sample_rate (RetroPaPlayer *self,
sample_spec.rate = (guint32) sample_rate;
sample_spec.channels = 2;
- if (self->simple != NULL)
- pa_simple_free (self->simple);
-
+ g_clear_pointer (&self->simple, pa_simple_free);
self->simple = pa_simple_new (NULL, NULL, PA_STREAM_PLAYBACK, NULL, "",
&sample_spec, NULL, NULL, &error);
if (!self->simple) {
@@ -231,11 +224,7 @@ retro_pa_player_set_core (RetroPaPlayer *self,
0);
}
- if (self->simple != NULL) {
- pa_simple_free (self->simple);
- self->simple = NULL;
- }
-
+ g_clear_pointer (&self->simple, pa_simple_free);
src_reset (self->src);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]