errval_t term_client_remove_trigger(struct term_client *client, term_trigger_id_t id) { errval_t err = SYS_ERR_OK; struct term_trigger_priv *removed = NULL; assert(client != NULL); assert(client->triggers != NULL); removed = collections_list_remove_if(client->triggers, trigger_list_id_cmp, &id); if (removed == NULL) { err = TERM_ERR_TRIGGER_NOT_FOUND; } return err; }
/* * Removes a specific element from the table. */ void collections_hash_delete(collections_hash_table *t, uint64_t key) { uint32_t bucket_num; collections_listnode *bucket; collections_hash_elem *elem; bucket_num = key % t->num_buckets; bucket = t->buckets[bucket_num]; elem = (collections_hash_elem*) collections_list_remove_if(bucket, match_key, &key); if (elem) { uint32_t n = t->num_elems; collections_hash_release_elem(elem, t); assert(1 == n - t->num_elems); } else { printf("Error: cannot find the node with key %" PRIu64 " in collections_hash_release\n", key); } }