[pulseaudio-discuss] [PATCH v3 2/5] bluetooth: Rename former device_use_audio()

Mikel Astiz mikel.astiz.oss at gmail.com
Thu Nov 22 06:20:25 PST 2012


From: Mikel Astiz <mikel.astiz at bmw-carit.de>

Use a more accurate name for the function since it doesn't just check
if it is an audio device (which can be detected quite early), but it
also checks if the most relevant properties (device info, etc.) have
been received.

Besides, add the const qualifier to the pointer since it's not going to
be modified.
---
 src/modules/bluetooth/bluetooth-util.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 84822aa..565bfce 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -187,7 +187,7 @@ static void device_free(pa_bluetooth_device *d) {
     pa_xfree(d);
 }
 
-static pa_bool_t device_is_audio(pa_bluetooth_device *d) {
+static pa_bool_t device_is_audio_ready(const pa_bluetooth_device *d) {
     pa_assert(d);
 
     return
@@ -467,7 +467,7 @@ static int parse_audio_property(pa_bluetooth_discovery *u, int *state, DBusMessa
 static void run_callback(pa_bluetooth_device *d, pa_bool_t dead) {
     pa_assert(d);
 
-    if (!device_is_audio(d))
+    if (!device_is_audio_ready(d))
         return;
 
     d->dead = dead;
@@ -949,7 +949,7 @@ pa_bluetooth_device* pa_bluetooth_discovery_get_by_address(pa_bluetooth_discover
 
     while ((d = pa_hashmap_iterate(y->devices, &state, NULL)))
         if (pa_streq(d->address, address))
-            return device_is_audio(d) ? d : NULL;
+            return device_is_audio_ready(d) ? d : NULL;
 
     return NULL;
 }
@@ -965,7 +965,7 @@ pa_bluetooth_device* pa_bluetooth_discovery_get_by_path(pa_bluetooth_discovery *
         pa_bluetooth_discovery_sync(y);
 
     if ((d = pa_hashmap_get(y->devices, path)))
-        if (device_is_audio(d))
+        if (device_is_audio_ready(d))
             return d;
 
     return NULL;
-- 
1.7.11.7



More information about the pulseaudio-discuss mailing list