From 2e64eee765247cfb7dee43455787e8ca3d764b31 Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Mon, 6 Mar 2023 12:53:36 -0800 Subject: [PATCH] Clean up dwmblocks-pulse-listener.c --- dwmblocks-pulse-listener.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/dwmblocks-pulse-listener.c b/dwmblocks-pulse-listener.c index fe0ea2e..032d1b1 100644 --- a/dwmblocks-pulse-listener.c +++ b/dwmblocks-pulse-listener.c @@ -41,17 +41,11 @@ static void server_info_callback(pa_context *ctx, const pa_server_info *info, static void subscribe_callback(pa_context *ctx, pa_subscription_event_type_t type, uint32_t idx, TargetData *target) { - unsigned int facility = type & PA_SUBSCRIPTION_EVENT_FACILITY_MASK; - pa_operation *op = NULL; - switch (facility) { - case PA_SUBSCRIPTION_EVENT_SINK: - op = pa_context_get_sink_info_by_index(ctx, - idx, - (pa_sink_info_cb_t) sink_info_callback, - target); - break; - } - if (op) { + if ((type & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SINK) { + pa_operation *op = pa_context_get_sink_info_by_index(ctx, + idx, + (pa_sink_info_cb_t) sink_info_callback, + target); pa_operation_unref(op); } }