sink, source: Always create a hashmap for ports.

Having the hashmap sometimes NULL requires a lot of checking
here and there, so ensuring that the hashmap is always
non-NULL simplifies the code.
This commit is contained in:
Tanu Kaskinen 2012-06-08 21:49:09 +03:00
parent 21c6c70438
commit 1a6da64b16
10 changed files with 56 additions and 66 deletions

View file

@ -121,12 +121,12 @@ static void find_sink_and_source(pa_card *card, pa_device_port *port, pa_sink **
if (port->is_output)
PA_IDXSET_FOREACH(sink, card->sinks, state)
if (sink->ports && port == pa_hashmap_get(sink->ports, port->name))
if (port == pa_hashmap_get(sink->ports, port->name))
break;
if (port->is_input)
PA_IDXSET_FOREACH(source, card->sources, state)
if (source->ports && port == pa_hashmap_get(source->ports, port->name))
if (port == pa_hashmap_get(source->ports, port->name))
break;
*si = sink;