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

Function append_obj_to_tail

libCacheSim/cache/cacheObj.c:210–229  ·  view source on GitHub ↗

* append the object to the tail of the doubly linked list * the object is not in the list, otherwise, use move_obj_to_tail * @param head * @param tail * @param cache_obj */

Source from the content-addressed store, hash-verified

208 * @param cache_obj
209 */
210void append_obj_to_tail(cache_obj_t **head, cache_obj_t **tail,
211 cache_obj_t *cache_obj) {
212
213 cache_obj->queue.next = NULL;
214 cache_obj->queue.prev = *tail;
215
216 if (head != NULL && *head == NULL) {
217 // the list is empty
218 DEBUG_ASSERT(*tail == NULL);
219 *head = cache_obj;
220 }
221
222 if (*tail != NULL) {
223 // the list has at least one element
224 (*tail)->queue.next = cache_obj;
225 }
226
227
228 *tail = cache_obj;
229}

Callers 6

LFUDA_findFunction · 0.85
LFUDA_insertFunction · 0.85
LFU_findFunction · 0.85
LFU_insertFunction · 0.85
CAR_insertFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected