[PATCH] android/handsfree: Refactor handle_dial()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

Call callback only once.
---
 android/hal-handsfree.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/android/hal-handsfree.c b/android/hal-handsfree.c
index 0f5e1d7..986e745 100644
--- a/android/hal-handsfree.c
+++ b/android/hal-handsfree.c
@@ -86,6 +86,7 @@ static void handle_dial(void *buf, uint16_t len, int fd)
 {
 	struct hal_ev_handsfree_dial *ev = buf;
 	uint16_t num_len = ev->number_len;
+	char *number = NULL;
 
 	if (len != sizeof(*ev) + num_len ||
 			(num_len != 0 && ev->number[num_len - 1] != '\0')) {
@@ -97,9 +98,9 @@ static void handle_dial(void *buf, uint16_t len, int fd)
 		return;
 
 	if (ev->number_len)
-		cbs->dial_call_cmd_cb((char *) ev->number);
-	else
-		cbs->dial_call_cmd_cb(NULL);
+		number = (char *) ev->number;
+
+	cbs->dial_call_cmd_cb(number);
 }
 
 static void handle_dtmf(void *buf, uint16_t len, int fd)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux