Re: [PATCH 2/8] android/bluetooth: Use single list for device caching

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

 



Hi Szymon,

> @@ -809,20 +778,8 @@ static void update_found_device(const bdaddr_t *bdaddr, uint8_t bdaddr_type,
>                 return;
>         }
>
> -       if (!g_slist_find_custom(found_devices, bdaddr, bdaddr_cmp)) {
> -               bdaddr_t *new_bdaddr;
> -               char addr[18];
> -
> -               new_bdaddr = g_new0(bdaddr_t, 1);
> -               bacpy(new_bdaddr, bdaddr);
> -
> -               found_devices = g_slist_prepend(found_devices, new_bdaddr);
> -
> -               ba2str(new_bdaddr, addr);
> -               DBG("New device found: %s", addr);
> -
> -               new_dev = true;
> -       }
> +       new_dev = !g_slist_find_custom(devices, bdaddr, bdaddr_cmp);
> +       dev = get_device(bdaddr);

This is not very efficient since get_device does the lookup again you
might want to use what g_slist_find_custom return or split get_device
internally in 2 e.g. find_device and create_device which can be used
by get_device or separately.

-- 
Luiz Augusto von Dentz
--
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