summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2014-05-22 22:26:43 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-05-22 22:26:43 +0000
commit4ecbda41c921f3209e96a3d72928a4bcba9422e6 (patch)
tree47d80a249e8ea332bf38b887a8fe489127f6185f
parent08befc3a8066626bb7336dd9ad656e737712153e (diff)
parentf8a1089ab5d3976c631cfe7b40eca8a5ed34c306 (diff)
downloadcore-4ecbda41c921f3209e96a3d72928a4bcba9422e6.tar.gz
Merge "Add list_add_head to libcutils"
-rw-r--r--include/cutils/list.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/cutils/list.h b/include/cutils/list.h
index 945729ab2..6e94ddf66 100644
--- a/include/cutils/list.h
+++ b/include/cutils/list.h
@@ -63,6 +63,14 @@ static inline void list_add_tail(struct listnode *head, struct listnode *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)
{
item->next->prev = item->prev;