From: "João Paulo Rechi Vita" <jprvita@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: "Luiz Augusto von Dentz" <luiz.dentz@gmail.com>,
"João Paulo Rechi Vita" <jprvita@gmail.com>
Subject: [PATCH] Small optimization on audio IPC.
Date: Sat, 15 Aug 2009 23:44:13 -0300 [thread overview]
Message-ID: <1250390653-476-2-git-send-email-jprvita@gmail.com> (raw)
In-Reply-To: <1250390653-476-1-git-send-email-jprvita@gmail.com>
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.
---
audio/unix.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/audio/unix.c b/audio/unix.c
index 23e2382..e0307e0 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))
--
1.6.0.4
next prev parent reply other threads:[~2009-08-16 2:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-16 2:44 [PATCH] Add support for the source interface to audio IPC João Paulo Rechi Vita
2009-08-16 2:44 ` João Paulo Rechi Vita [this message]
2009-08-16 14:39 ` Johan Hedberg
2009-08-16 16:38 ` Luiz Augusto von Dentz
2009-08-16 17:36 ` Johan Hedberg
2009-08-16 17:51 ` Luiz Augusto von Dentz
2009-08-16 18:26 ` Johan Hedberg
2009-08-16 22:10 ` Johan Hedberg
2009-08-16 23:00 ` João Paulo Rechi Vita
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1250390653-476-2-git-send-email-jprvita@gmail.com \
--to=jprvita@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox