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

Hauke Petersen notifications at github.com
Wed Mar 27 15:17:28 CET 2019


haukepetersen 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 see it on the contrary: using a well-tested external list library is less error prone than using a custom array construct.

So my reasons:
- lists are more elegant
- lists are more efficient (except for the `nimble_scanlist_get_by_pos()`)
- lists are well tested
- no code duplication

-- 
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_r269584793
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190327/ca39daa9/attachment.html>


More information about the notifications mailing list