MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / remove_obj_from_list

Function remove_obj_from_list

libCacheSim/cache/cacheObj.c:57–76  ·  view source on GitHub ↗

remove the object from the built-in doubly linked list * * @param head * @param tail * @param cache_obj */

Source from the content-addressed store, hash-verified

55 * @param cache_obj
56 */
57void remove_obj_from_list(cache_obj_t **head, cache_obj_t **tail,
58 cache_obj_t *cache_obj) {
59 if (head != NULL && cache_obj == *head) {
60 *head = cache_obj->queue.next;
61 if (cache_obj->queue.next != NULL) cache_obj->queue.next->queue.prev = NULL;
62 }
63 if (tail != NULL && cache_obj == *tail) {
64 *tail = cache_obj->queue.prev;
65 if (cache_obj->queue.prev != NULL) cache_obj->queue.prev->queue.next = NULL;
66 }
67
68 if (cache_obj->queue.prev != NULL)
69 cache_obj->queue.prev->queue.next = cache_obj->queue.next;
70
71 if (cache_obj->queue.next != NULL)
72 cache_obj->queue.next->queue.prev = cache_obj->queue.prev;
73
74 cache_obj->queue.prev = NULL;
75 cache_obj->queue.next = NULL;
76}
77
78/**
79 * move an object to the tail of the doubly linked list

Callers 15

LRU_Prob_evictFunction · 0.85
LRU_Prob_remove_objFunction · 0.85
Clock_evictFunction · 0.85
Clock_remove_objFunction · 0.85
FIFO_removeFunction · 0.85
LFUDA_findFunction · 0.85
LFUDA_evictFunction · 0.85
LFUDA_remove_objFunction · 0.85
LFU_findFunction · 0.85
LFU_evictFunction · 0.85
LFU_remove_objFunction · 0.85
LRU_remove_objFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected