summaryrefslogtreecommitdiffstats
path: root/hcid/dbus-hci.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2008-03-12 21:37:20 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2008-03-12 21:37:20 +0000
commit6bfa88d706cc57a0c975c980dabec5d8ed67dcc0 (patch)
treea8ce186c452fa2fdd57dee93bfc7e9a4498c332d /hcid/dbus-hci.c
parent45e65bdb0940fc3a815e75c58842ed0e56dd4dab (diff)
Keep a list of device's structure pointers instead of paths
Diffstat (limited to 'hcid/dbus-hci.c')
-rw-r--r--hcid/dbus-hci.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c
index 92aed10f..837d47af 100644
--- a/hcid/dbus-hci.c
+++ b/hcid/dbus-hci.c
@@ -451,7 +451,7 @@ int unregister_adapter_path(const char *path)
}
if (adapter->devices) {
- g_slist_foreach(adapter->devices, (GFunc) free, NULL);
+ g_slist_foreach(adapter->devices, (GFunc) device_destroy, NULL);
g_slist_free(adapter->devices);
}
@@ -575,11 +575,11 @@ static void create_stored_device(char *key, char *value, void *user_data)
{
struct adapter *adapter = user_data;
GSList *uuids = bt_string2list(value);
- const gchar *path;
+ struct device *device;
- path = device_create(adapter, key, uuids);
-
- adapter->devices = g_slist_append(adapter->devices, g_strdup(path));
+ device = device_create(adapter, key, uuids);
+ if (device)
+ adapter->devices = g_slist_append(adapter->devices, device);
}
static void register_devices(bdaddr_t *src, struct adapter *adapter)
@@ -783,13 +783,6 @@ int hcid_dbus_stop_device(uint16_t id)
adapter->active_conn = NULL;
}
- if (adapter->devices) {
- g_slist_foreach(adapter->devices, (GFunc) device_remove, NULL);
- g_slist_foreach(adapter->devices, (GFunc) free, NULL);
- g_slist_free(adapter->devices);
- adapter->devices = NULL;
- }
-
send_adapter_signal(connection, adapter->dev_id, "ModeChanged",
DBUS_TYPE_STRING, &mode,
DBUS_TYPE_INVALID);