diff mbox series

[05/12] audio/pw: needless check for NULL

Message ID 20230506163735.3481387-6-marcandre.lureau@redhat.com (mailing list archive)
State New, archived
Headers show
Series audio: pipewire backend improvements | expand

Commit Message

Marc-André Lureau May 6, 2023, 4:37 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

g_clear_pointer() already checks for NULL.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 audio/pwaudio.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Volker Rümelin May 7, 2023, 3:01 p.m. UTC | #1
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> g_clear_pointer() already checks for NULL.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   audio/pwaudio.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)

Reviewed-by: Volker Rümelin <vr_qemu@t-online.de>

> diff --git a/audio/pwaudio.c b/audio/pwaudio.c
> index 51cfc0b052..6ca4ef4f62 100644
> --- a/audio/pwaudio.c
> +++ b/audio/pwaudio.c
> @@ -834,12 +834,8 @@ fail:
>       if (pw->thread_loop) {
>           pw_thread_loop_stop(pw->thread_loop);
>       }
> -    if (pw->context) {
> -        g_clear_pointer(&pw->context, pw_context_destroy);
> -    }
> -    if (pw->thread_loop) {
> -        g_clear_pointer(&pw->thread_loop, pw_thread_loop_destroy);
> -    }
> +    g_clear_pointer(&pw->context, pw_context_destroy);
> +    g_clear_pointer(&pw->thread_loop, pw_thread_loop_destroy);
>       return NULL;
>   }
>
diff mbox series

Patch

diff --git a/audio/pwaudio.c b/audio/pwaudio.c
index 51cfc0b052..6ca4ef4f62 100644
--- a/audio/pwaudio.c
+++ b/audio/pwaudio.c
@@ -834,12 +834,8 @@  fail:
     if (pw->thread_loop) {
         pw_thread_loop_stop(pw->thread_loop);
     }
-    if (pw->context) {
-        g_clear_pointer(&pw->context, pw_context_destroy);
-    }
-    if (pw->thread_loop) {
-        g_clear_pointer(&pw->thread_loop, pw_thread_loop_destroy);
-    }
+    g_clear_pointer(&pw->context, pw_context_destroy);
+    g_clear_pointer(&pw->thread_loop, pw_thread_loop_destroy);
     return NULL;
 }