[PATCH BlueZ v3 20/27] network: Add trivial helper function

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

 



From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx>

Simplify the code and make it more readable by adding a trivial helper
function.
---
 profiles/network/connection.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/profiles/network/connection.c b/profiles/network/connection.c
index cc7c5ce..16ee318 100644
--- a/profiles/network/connection.c
+++ b/profiles/network/connection.c
@@ -85,6 +85,11 @@ struct __service_16 {
 
 static GSList *peers = NULL;
 
+static uint16_t get_service_id(struct btd_service *service)
+{
+	return bnep_service_id(btd_service_get_profile(service)->remote_uuid);
+}
+
 static struct network_peer *find_peer(GSList *list, struct btd_device *device)
 {
 	for (; list; list = list->next) {
@@ -644,9 +649,8 @@ static const GDBusPropertyTable connection_properties[] = {
 void connection_unregister(struct btd_service *service)
 {
 	struct btd_device *device = btd_service_get_device(service);
-	struct btd_profile *p = btd_service_get_profile(service);
 	struct network_peer *peer;
-	uint16_t id = bnep_service_id(p->remote_uuid);
+	uint16_t id = get_service_id(service);
 
 	DBG("%s id %u", device_get_path(device), id);
 
@@ -692,10 +696,9 @@ static struct network_peer *create_peer(struct btd_device *device)
 int connection_register(struct btd_service *service)
 {
 	struct btd_device *device = btd_service_get_device(service);
-	struct btd_profile *p = btd_service_get_profile(service);
 	struct network_peer *peer;
 	struct network_conn *nc;
-	uint16_t id = bnep_service_id(p->remote_uuid);
+	uint16_t id = get_service_id(service);
 
 	DBG("%s id %u", device_get_path(device), id);
 
-- 
1.8.1.4

--
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