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); } }