-int list_insert (list_t *list, node_t *item) {
- TRACE("l3", "list_insert: inserting %p (with key %llu)", item, item->key);
- node_t *pred, *next, *other = (node_t *)-1;
+// Fast find. Do not help unlink partially removed nodes and do not return the found item's predecessor.
+uint64_t list_lookup (list_t *list, uint64_t key) {
+ TRACE("l3", "list_lookup: searching for key %p in list %p", key, list);
+ node_t *item = find_pred(NULL, list, key, FALSE);
+
+ // If we found an <item> matching the <key> return its value.
+ return (item->key == key) ? item->value : DOES_NOT_EXIST;
+}
+
+// Insert the <key>, if it doesn't already exist in the <list>
+uint64_t list_add (list_t *list, uint64_t key, uint64_t value) {
+ TRACE("l3", "list_add: inserting key %p value %p", key, value);
+ node_t *pred;
+ node_t *item = NULL;