4 void mru_append(struct mru *mru, void *item)
6 struct mru_entry *cur = xmalloc(sizeof(*cur));
12 mru->tail->next = cur;
18 void mru_mark(struct mru *mru, struct mru_entry *entry)
20 /* If we're already at the front of the list, nothing to do */
21 if (mru->head == entry)
24 /* Otherwise, remove us from our current slot... */
26 entry->prev->next = entry->next;
28 entry->next->prev = entry->prev;
30 mru->tail = entry->prev;
32 /* And insert us at the beginning. */
34 entry->next = mru->head;
36 mru->head->prev = entry;
40 void mru_clear(struct mru *mru)
42 struct mru_entry *p = mru->head;
45 struct mru_entry *to_free = p;
49 mru->head = mru->tail = NULL;