summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-10-28 23:31:13 +0200
committerJohan Hedberg <johan.hedberg@nokia.com>2008-10-28 23:31:13 +0200
commite0baf6af60783937e774229730b56846cfe27673 (patch)
treedb8cce662338597f204462be3a5480681a264ee6
parentb12f6eaa5b3f65a5b5f9c98e358f2f6ca912ef97 (diff)
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.
-rw-r--r--src/dbus-hci.c18
1 files 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);
}