[pulseaudio-discuss] [PATCH next v0 04/10] bluetooth: Move profile_to_string() up

Mikel Astiz mikel.astiz.oss at gmail.com
Wed Dec 12 04:17:04 PST 2012


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

Trivially move the function to the beginning of the file and at the
same time avoid using the default clause in order to make sure the
compiler will complain if the enum type gets extended.
---
 src/modules/bluetooth/module-bluetooth-device.c | 32 +++++++++++++------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 547aea3..5dee2b3 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -209,6 +209,23 @@ enum {
 
 static int init_profile(struct userdata *u);
 
+static const char *profile_to_string(enum profile profile) {
+    switch(profile) {
+        case PROFILE_A2DP:
+            return "a2dp";
+        case PROFILE_A2DP_SOURCE:
+            return "a2dp_source";
+        case PROFILE_HSP:
+            return "hsp";
+        case PROFILE_HFGW:
+            return "hfgw";
+        case PROFILE_OFF:
+            pa_assert_not_reached();
+    }
+
+    pa_assert_not_reached();
+}
+
 /* from IO thread */
 static void a2dp_set_bitpool(struct userdata *u, uint8_t bitpool)
 {
@@ -1654,21 +1671,6 @@ static void connect_ports(struct userdata *u, void *sink_or_source_new_data, pa_
     }
 }
 
-static const char *profile_to_string(enum profile profile) {
-    switch(profile) {
-        case PROFILE_A2DP:
-            return "a2dp";
-        case PROFILE_A2DP_SOURCE:
-            return "a2dp_source";
-        case PROFILE_HSP:
-            return "hsp";
-        case PROFILE_HFGW:
-            return "hfgw";
-        default:
-            pa_assert_not_reached();
-    }
-}
-
 static int sink_set_port_cb(pa_sink *s, pa_device_port *p) {
     return 0;
 }
-- 
1.7.11.7



More information about the pulseaudio-discuss mailing list