diff --git a/common/include/villas/list.h b/common/include/villas/list.h index e463ae479..0cc51eab7 100644 --- a/common/include/villas/list.h +++ b/common/include/villas/list.h @@ -123,18 +123,6 @@ void vlist_extend(struct vlist *l, size_t len, void *val); /** Remove all elements for which the callback returns a non-zero return code. */ void vlist_filter(struct vlist *l, dtor_cb_t cb); -/** Lookup an element from the list based on an UUID */ -template -T * vlist_lookup_uuid(struct vlist *l, uuid_t uuid) -{ - return (T *) vlist_search(l, [](const void *a, const void *b) -> int { - auto *n = reinterpret_cast(a); - uuid_t u; memcpy(u, b, sizeof(uuid_t)); - - return uuid_compare(n->uuid, u); - }, uuid); -} - /** Lookup an element from the list based on a name */ template T * vlist_lookup_name(struct vlist *l, const std::string &name) @@ -155,5 +143,3 @@ ssize_t vlist_lookup_index(struct vlist *l, const std::string &name) return f ? vlist_index(l, f) : -1; } - -int vlist_init_and_push(struct vlist *l, void *p); diff --git a/common/lib/list.cpp b/common/lib/list.cpp index a72d20ddf..06291d486 100644 --- a/common/lib/list.cpp +++ b/common/lib/list.cpp @@ -94,7 +94,7 @@ void vlist_clear(struct vlist *l) pthread_mutex_lock(&l->lock); l->length = 0; - + pthread_mutex_unlock(&l->lock); } @@ -291,18 +291,3 @@ void vlist_filter(struct vlist *l, dtor_cb_t cb) pthread_mutex_unlock(&l->lock); } - -int vlist_init_and_push(struct vlist *l, void *p) -{ - int ret; - - if (l->state == State::DESTROYED) { - ret = vlist_init(l); - if (ret) - return ret; - } - - vlist_push(l, p); - - return 0; -} diff --git a/common/tests/unit/list.cpp b/common/tests/unit/list.cpp index 56997074e..6795ceb87 100644 --- a/common/tests/unit/list.cpp +++ b/common/tests/unit/list.cpp @@ -40,33 +40,6 @@ struct data { // cppcheck-suppress unknownMacro TestSuite(list, .description = "List datastructure"); -Test(list, vlist_lookup_name) -{ - int ret; - struct vlist l; - - ret = vlist_init(&l); - cr_assert_eq(ret, 0); - - for (unsigned i = 0; i < ARRAY_LEN(nouns); i++) { - struct data *d = new struct data; - if (!d) - throw MemoryAllocationError(); - - d->name = nouns[i]; - d->data = i; - - vlist_push(&l, d); - } - - struct data *found = vlist_lookup_name(&l, "woman"); - - cr_assert_eq(found->data, 13); - - ret = vlist_destroy(&l, nullptr, true); - cr_assert_eq(ret, 0); -} - Test(list, vlist_search) { int ret;