Explorar o código

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 %!s(int64=21) %!d(string=hai) anos
pai
achega
4c734cb44f
Modificáronse 1 ficheiros con 12 adicións e 0 borrados
  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;
 	new->prev = head;
 	head->next = new;
 	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)
 static void inline list_del (struct list_head *remove)
 {
 {
 	remove->next->prev = remove->prev;
 	remove->next->prev = remove->prev;
@@ -72,4 +79,9 @@ static void inline list_del (struct list_head *remove)
 #define list_entry(ptr,type,member)\
 #define list_entry(ptr,type,member)\
 	((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->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 */
 #endif /* LIST_H_DEFINED */