device: Change signature of connman_device_remove_network()
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Mon, 25 Jul 2011 14:24:33 +0000 (16:24 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 25 Jul 2011 23:21:59 +0000 (01:21 +0200)
include/device.h
plugins/bluetooth.c
plugins/ethernet.c
plugins/ofono.c
plugins/wifi.c
src/device.c

index a82d08d..d4f54ec 100644 (file)
@@ -88,7 +88,7 @@ int connman_device_add_network(struct connman_device *device,
 struct connman_network *connman_device_get_network(struct connman_device *device,
                                                        const char *identifier);
 int connman_device_remove_network(struct connman_device *device,
-                                                       const char *identifier);
+                                       struct connman_network *network);
 void connman_device_remove_all_networks(struct connman_device *device);
 
 void connman_device_schedule_scan(struct connman_device *device);
index ccc5e9b..65a9d5d 100644 (file)
@@ -549,7 +549,7 @@ static gboolean adapter_changed(DBusConnection *connection,
 static gboolean device_removed(DBusConnection *connection,
                                DBusMessage *message, void *user_data)
 {
-       const char *network_path, *identifier;
+       const char *network_path;
        struct connman_network *network;
        struct connman_device *device;
        DBusMessageIter iter;
@@ -569,11 +569,9 @@ static gboolean device_removed(DBusConnection *connection,
        if (device == NULL)
                return TRUE;
 
-       identifier = connman_network_get_identifier(network);
-
        g_hash_table_remove(bluetooth_networks, network_path);
 
-       connman_device_remove_network(device, identifier);
+       connman_device_remove_network(device, network);
 
        return TRUE;
 }
index 5c02640..8295093 100644 (file)
@@ -115,13 +115,10 @@ static void add_network(struct connman_device *device,
 static void remove_network(struct connman_device *device,
                                struct ethernet_data *ethernet)
 {
-       const char *identifier;
-
        if (ethernet->network == NULL)
                return;
 
-       identifier = connman_network_get_identifier(ethernet->network);
-       connman_device_remove_network(device, identifier);
+       connman_device_remove_network(device, ethernet->network);
        connman_network_unref(ethernet->network);
 
        ethernet->network = NULL;
index 9cc48c6..c0deb9f 100644 (file)
@@ -1739,7 +1739,7 @@ static gboolean context_removed(DBusConnection *connection,
                                DBusMessage *message, void *user_data)
 {
        const char *path = dbus_message_get_path(message);
-       const char *network_path, *identifier;
+       const char *network_path;
        struct modem_data *modem;
        struct network_info *info;
        DBusMessageIter iter;
@@ -1759,8 +1759,7 @@ static gboolean context_removed(DBusConnection *connection,
        if (info == NULL)
                return TRUE;
 
-       identifier = connman_network_get_identifier(info->network);
-       connman_device_remove_network(modem->device, identifier);
+       connman_device_remove_network(modem->device, info->network);
 
        return TRUE;
 }
index 8a7da09..edea4e7 100644 (file)
@@ -831,15 +831,15 @@ static void network_removed(GSupplicantNetwork *network)
 
        DBG("name %s", name);
 
-       if (wifi != NULL) {
-               connman_network = connman_device_get_network(wifi->device, identifier);
-
-               connman_device_remove_network(wifi->device, identifier);
+       if (wifi == NULL)
+               return;
 
-               if (connman_network != NULL)
-                       connman_network_unref(connman_network);
+       connman_network = connman_device_get_network(wifi->device, identifier);
+       if (connman_network == NULL)
+               return;
 
-       }
+       connman_device_remove_network(wifi->device, connman_network);
+       connman_network_unref(connman_network);
 }
 
 static void debug(const char *str)
index 87f503d..39c3fc0 100644 (file)
@@ -1104,19 +1104,19 @@ struct connman_network *connman_device_get_network(struct connman_device *device
  * Remove network for given identifier
  */
 int connman_device_remove_network(struct connman_device *device,
-                                                       const char *identifier)
+                                               struct connman_network *network)
 {
-       struct connman_network *network;
        struct connman_service *service;
+       const char *identifier;
 
-       DBG("device %p identifier %s", device, identifier);
+       DBG("device %p network %p", device, network);
 
-       network = connman_device_get_network(device, identifier);
        if (network == NULL)
                return 0;
 
        service = __connman_service_lookup_from_network(network);
 
+       identifier = connman_network_get_identifier(network);
        g_hash_table_remove(device->networks, identifier);
 
        if (service != NULL)