mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-15 04:39:42 +03:00
allow having a resource list instead of a hash
this brings O(n) lookup time for resources, but allows removing dynamic memory management
This commit is contained in:
1 parent
d573c0779a
commit
f3d98c9a2b
2 files changed
+8
-13
No files matched your search
@@ -22,4 +22,6 @@ known to be needed -- but it's optional here (the lwIP port will also run if
|
||||
you choose to malloc everything and undef this again) */
|
||||
#define COAP_STATIC_RESOURCES
|
||||
|
||||
#define COAP_RESOURCES_NOHASH
|
||||
|
||||
#endif /* _CONFIG_H_ */
|
||||
+6
-13
@@ -589,20 +589,7 @@ coap_delete_observer(coap_resource_t *resource, const coap_address_t *observer,
|
||||
if (s) {
|
||||
list_remove(resource->subscribers, s);
|
||||
|
||||
<<<<<<< HEAD
|
||||
COAP_FREE_TYPE(subscription,s);
|
||||
=======
|
||||
/* FIXME: notify observer that its subscription has been removed */
|
||||
#ifdef WITH_LWIP
|
||||
memp_free(MEMP_COAP_SUBSCRIBER, s);
|
||||
#endif
|
||||
#ifdef WITH_POSIX
|
||||
coap_free(s);
|
||||
#endif
|
||||
#ifdef WITH_CONTIKI
|
||||
memb_free(&subscription_storage, s);
|
||||
#endif /* WITH_CONTIKI */
|
||||
>>>>>>> use lwip pools for observations
|
||||
}
|
||||
}
|
||||
|
||||
@@ -689,11 +676,17 @@ coap_check_notify(coap_context_t *context) {
|
||||
#ifdef COAP_RESOURCES_NOHASH
|
||||
LL_FOREACH(context->resources, r) {
|
||||
#else
|
||||
<<<<<<< HEAD
|
||||
coap_resource_t *tmp;
|
||||
HASH_ITER(hh, context->resources, r, tmp) {
|
||||
#endif
|
||||
coap_notify_observers(context, r);
|
||||
}
|
||||
=======
|
||||
HASH_ITER(hh, context->resources, r, tmp) {
|
||||
#endif
|
||||
if (r->observable && r->dirty && r->subscribers) {
|
||||
>>>>>>> allow having a resource list instead of a hash
|
||||
#else /* WITH_CONTIKI */
|
||||
int i;
|
||||
|
||||
|
||||
Reference in new issue
Block a user