-static void get_sink_info(pa_context *c, uint32_t idx) {
- pa_operation *o =
- idx == DEFAULT_SINK_INDEX ? pa_context_get_sink_info_by_name(
- c, "@DEFAULT_SINK@", store_volume_from_sink_cb, NULL)
- : pa_context_get_sink_info_by_index(
- c, idx, store_volume_from_sink_cb, NULL);
- pulseaudio_free_operation(c, o);
+static void get_sink_info(pa_context *c, uint32_t idx, const char *name) {
+ pa_operation *o;
+
+ if (name || idx == DEFAULT_SINK_INDEX) {
+ o = pa_context_get_sink_info_by_name(
+ c, name ? name : "@DEFAULT_SINK@", store_volume_from_sink_cb, NULL);
+ } else {
+ o = pa_context_get_sink_info_by_index(
+ c, idx, store_volume_from_sink_cb, NULL);
+ }
+ if (o) {
+ pulseaudio_free_operation(c, o);
+ }