card: Ensure that there's always at least one profile.

In practice there is always at least one profile, and I
don't think there will ever be cards without profiles.
Therefore, I added assertions to pa_card_new() stating that
the card new data must always contain at least one profile.
Now a lot of code can be simplified, because it's guaranteed
that the profiles hashmap and the active_profile field are
always non-NULL.
This commit is contained in:
Tanu Kaskinen 2012-06-08 21:49:10 +03:00
parent 1a6da64b16
commit 12af302ac7
9 changed files with 35 additions and 70 deletions

View file

@ -2852,8 +2852,6 @@ static int add_card(struct userdata *u, const pa_bluetooth_device *device) {
return -1;
}
data.profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
/* we base hsp/a2dp availability on UUIDs.
Ideally, it would be based on "Connected" state, but
we can't afford to wait for this information when