comparison mcabber/src/list.h @ 28:0cd8025eebee

[/trunk] Changeset 44 by mikael * Some more fixes. * We can now build with GNU99 gcc extensions.
author mikael
date Mon, 28 Mar 2005 10:36:47 +0000
parents e88b15cbf2de
children f8f3c7493457
comparison
equal deleted inserted replaced
27:77e6bd2ccde6 28:0cd8025eebee
82 } 82 }
83 83
84 /** 84 /**
85 * list_del - deletes entry from list. 85 * list_del - deletes entry from list.
86 * @entry: the element to delete from the list. 86 * @entry: the element to delete from the list.
87 * Note: list_empty on entry does not return true after this, the entry is in an undefined state. 87 * Note: list_empty on entry does not return true after this, the entry is
88 * in an undefined state.
88 */ 89 */
89 static inline void list_del(struct list_head *entry) 90 static inline void list_del(struct list_head *entry)
90 { 91 {
91 __list_del(entry->prev, entry->next); 92 __list_del(entry->prev, entry->next);
92 entry->next = (void *) 0; 93 entry->next = (void *) 0;
126 __list_del(list->prev, list->next); 127 __list_del(list->prev, list->next);
127 list_add_tail(list, head); 128 list_add_tail(list, head);
128 } 129 }
129 130
130 /** 131 /**
131 * list_empty - tests whether a list is empty 132 * list_empty - test whether a list is empty
132 * @head: the list to test. 133 * @head: the list to test.
133 */ 134 */
134 static inline int list_empty(struct list_head *head) 135 static inline int list_empty(struct list_head *head)
135 { 136 {
136 return head->next == head; 137 return head->next == head;
186 */ 187 */
187 #define list_entry(ptr, type, member) \ 188 #define list_entry(ptr, type, member) \
188 ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) 189 ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
189 190
190 /** 191 /**
191 * list_for_each_safe - iterate over a list safe against removal of list entry 192 * list_for_each_safe - iterate over a list safe against removal of list entry
192 * @pos: the &struct list_head to use as a loop counter. 193 * @pos: the &struct list_head to use as a loop counter.
193 * @n: another &struct list_head to use as temporary storage 194 * @n: another &struct list_head to use as temporary storage
194 * @head: the head for your list. 195 * @head: the head for your list.
195 */ 196 */
196 #define list_for_each_safe(pos, n, head) \ 197 #define list_for_each_safe(pos, n, head) \
197 for (pos = (head)->next, n = pos->next; pos != (head); \ 198 for (pos = (head)->next, n = pos->next; pos != (head); \
198 pos = n, n = pos->next) 199 pos = n, n = pos->next)
199 200
200 /** 201 /**
201 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry 202 * list_for_each_entry_safe - iterate over list of given type safe against
203 * removal of list entry
202 * @pos: the type * to use as a loop counter. 204 * @pos: the type * to use as a loop counter.
203 * @n: another type * to use as temporary storage 205 * @n: another type * to use as temporary storage
204 * @head: the head for your list. 206 * @head: the head for your list.
205 * @member: the name of the list_struct within the struct. 207 * @member: the name of the list_struct within the struct.
206 */ 208 */