* 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 */
| 208 | * @param cache_obj |
| 209 | */ |
| 210 | void 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 | } |
no outgoing calls
no test coverage detected