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

@ -2073,13 +2073,10 @@ static void connect_ports(struct userdata *u, void *sink_or_source_new_data, pa_
} data;
pa_device_port *port;
if (direction == PA_DIRECTION_OUTPUT) {
if (direction == PA_DIRECTION_OUTPUT)
data.sink_new_data = sink_or_source_new_data;
data.sink_new_data->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
} else {
else
data.source_new_data = sink_or_source_new_data;
data.source_new_data->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
}
switch (u->profile) {
case PROFILE_A2DP:
@ -2118,7 +2115,7 @@ static void connect_ports(struct userdata *u, void *sink_or_source_new_data, pa_
default:
pa_assert_not_reached();
}
}
}
/* Run from main thread */