Просмотр исходного кода

Add in list_add_tail and list_empty functions

(Logical change 1.63)


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@227 fd59a12c-fef9-0310-b244-a6a79926bd2f
Mark Haverkamp 21 лет назад
Родитель
Сommit
4c734cb44f
1 измененных файлов с 12 добавлено и 0 удалено
  1. 12 0
      include/list.h

+ 12 - 0
include/list.h

@@ -59,6 +59,13 @@ static void inline list_add (struct list_head *new, struct list_head *head)
 	new->prev = head;
 	head->next = new;
 }
+static void inline list_add_tail (struct list_head *new, struct list_head *head)
+{
+	head->prev->next = new;
+	new->next = head;
+	new->prev = head->prev;
+	head->prev = new;
+}
 static void inline list_del (struct list_head *remove)
 {
 	remove->next->prev = remove->prev;
@@ -72,4 +79,9 @@ static void inline list_del (struct list_head *remove)
 #define list_entry(ptr,type,member)\
 	((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
 
+static inline int list_empty(struct list_head *l)
+{
+	return l->next == l;
+}
+
 #endif /* LIST_H_DEFINED */