[riot-notifications] [RIOT-OS/RIOT] ble/nimble: add scanlist submodule (#11278)

Martine Lenders notifications at github.com
Wed Mar 27 16:15:16 CET 2019


miri64 commented on this pull request.



> +    if (ble_addr_cmp(&e->addr, addr) == 0) {
+        return 1;
+    }
+    return 0;
+}
+
+static nimble_scanlist_entry_t *_find(const ble_addr_t *addr)
+{
+    return (nimble_scanlist_entry_t *)clist_foreach(&_list, _finder,
+                                                    (void *)addr);
+}
+
+void nimble_scanlist_init(void)
+{
+    for (unsigned i = 0; i < (sizeof(_mem) / sizeof(_mem[0])); i++) {
+        clist_rpush(&_pool, &_mem[i].node);

I'm not arguing against the usage of `clist` here. I just see a risk in missing e.g. to re-add things to the pool after you don't need an item in `_list` anymore at a later point. Your data structure would starve itself of resources. Without tests it is hard to spot such a regression. However, I'm not blocking because of that.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11278#discussion_r269616448
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190327/a5368ccc/attachment.html>


More information about the notifications mailing list