Merge "Add list_add_head to libcutils"

This commit is contained in:
Colin Cross 2014-05-22 22:26:43 +00:00 committed by Gerrit Code Review
commit 4ecbda41c9

View file

@ -63,6 +63,14 @@ static inline void list_add_tail(struct listnode *head, struct listnode *item)
head->prev = item; head->prev = item;
} }
static inline void list_add_head(struct listnode *head, struct listnode *item)
{
item->next = head->next;
item->prev = head;
head->next->prev = item;
head->next = item;
}
static inline void list_remove(struct listnode *item) static inline void list_remove(struct listnode *item)
{ {
item->next->prev = item->prev; item->next->prev = item->prev;