diff options
author | João Paulo Rechi Vita <jprvita@gmail.com> | 2009-08-15 23:44:13 -0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2009-08-17 01:05:40 +0300 |
commit | b49a0e138f700c8f4ece3d3a251da96732d0d553 (patch) | |
tree | af57d636be3e516cda5ecbc86077e9bfa5e4b623 /audio | |
parent | 8611df700132af9e6503826fc2c2ca5071fae7cc (diff) | |
download | bluez-b49a0e138f700c8f4ece3d3a251da96732d0d553.tar.gz |
Small optimization on audio IPC.
Check if we find the device before trying to define an interface,
so if we fail the if comparison plus the strdup are not necessary.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/unix.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/audio/unix.c b/audio/unix.c index 23e238253..e0307e023 100644 --- a/audio/unix.c +++ b/audio/unix.c @@ -1257,14 +1257,13 @@ static void handle_getcapabilities_req(struct unix_client *client, str2ba(req->source, &src); str2ba(req->destination, &dst); + if (!manager_find_device(req->object, &src, &dst, NULL, FALSE)) + goto failed; + if (req->transport == BT_CAPABILITIES_TRANSPORT_SCO) client->interface = g_strdup(AUDIO_HEADSET_INTERFACE); else if (req->transport == BT_CAPABILITIES_TRANSPORT_A2DP) client->interface = g_strdup(AUDIO_SINK_INTERFACE); - - if (!manager_find_device(req->object, &src, &dst, NULL, FALSE)) - goto failed; - dev = manager_find_device(req->object, &src, &dst, client->interface, TRUE); if (!dev && (req->flags & BT_FLAG_AUTOCONNECT)) |