From e0baf6af60783937e774229730b56846cfe27673 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 28 Oct 2008 23:31:13 +0200 Subject: Simplify emit_device_found calls String types which are NULL will just be ignored so we don't need the extra check for name != NULL. --- src/dbus-hci.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/dbus-hci.c b/src/dbus-hci.c index c830f6c2..23c59414 100644 --- a/src/dbus-hci.c +++ b/src/dbus-hci.c @@ -974,11 +974,7 @@ void hcid_dbus_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class, path = adapter_get_path(adapter); icon = class_to_icon(class); - if (name) { - if (name_type != 0x08) - name_status = NAME_SENT; - - emit_device_found(path, paddr, + emit_device_found(path, paddr, "Address", DBUS_TYPE_STRING, &paddr, "Class", DBUS_TYPE_UINT32, &class, "Icon", DBUS_TYPE_STRING, &icon, @@ -986,20 +982,14 @@ void hcid_dbus_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class, "Name", DBUS_TYPE_STRING, &name, "Alias", DBUS_TYPE_STRING, &alias, NULL); - g_free(name); - } else { - emit_device_found(path, paddr, - "Address", DBUS_TYPE_STRING, &paddr, - "Class", DBUS_TYPE_UINT32, &class, - "Icon", DBUS_TYPE_STRING, &icon, - "RSSI", DBUS_TYPE_INT16, &tmp_rssi, - "Alias", DBUS_TYPE_STRING, &alias, NULL); - } + if (name && name_type != 0x08) + name_status = NAME_SENT; /* add in the list to track name sent/pending */ adapter_add_found_device(adapter, peer, rssi, class, real_alias, name_status); + g_free(name); g_free(alias); } -- cgit