diff options
author | Alasdair Kergon <agk@redhat.com> | 2006-04-19 15:33:07 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2006-04-19 15:33:07 +0000 |
commit | 8a2fc58645166dc8ec3a744bb0afeea7165cb750 (patch) | |
tree | f057a02b99c0d36fa57fa055beb123118fe72ad5 /libdm/datastruct | |
parent | d81e3d0bada9b5f1cd56d3594b6b377a5008f1af (diff) | |
download | lvm2-8a2fc58645166dc8ec3a744bb0afeea7165cb750.tar.gz lvm2-8a2fc58645166dc8ec3a744bb0afeea7165cb750.tar.xz lvm2-8a2fc58645166dc8ec3a744bb0afeea7165cb750.zip |
Check for libsepol.
Add some cflow & scope support.
Separate out DEFS from CFLAGS.
Remove inlines and use unique function names.
Diffstat (limited to 'libdm/datastruct')
-rw-r--r-- | libdm/datastruct/list.h | 79 |
1 files changed, 12 insertions, 67 deletions
diff --git a/libdm/datastruct/list.h b/libdm/datastruct/list.h index d996a8bd..316c537a 100644 --- a/libdm/datastruct/list.h +++ b/libdm/datastruct/list.h @@ -33,107 +33,61 @@ struct list { * The list head's next and previous pointers point back to itself. */ #define LIST_INIT(name) struct list name = { &(name), &(name) } -static inline void list_init(struct list *head) -{ - head->n = head->p = head; -} +void list_init(struct list *head); /* * Insert an element before 'head'. * If 'head' is the list head, this adds an element to the end of the list. */ -static inline void list_add(struct list *head, struct list *elem) -{ - assert(head->n); - - elem->n = head; - elem->p = head->p; - - head->p->n = elem; - head->p = elem; -} +void list_add(struct list *head, struct list *elem); /* * Insert an element after 'head'. * If 'head' is the list head, this adds an element to the front of the list. */ -static inline void list_add_h(struct list *head, struct list *elem) -{ - assert(head->n); - - elem->n = head->n; - elem->p = head; - - head->n->p = elem; - head->n = elem; -} +void list_add_h(struct list *head, struct list *elem); /* * Delete an element from its list. * Note that this doesn't change the element itself - it may still be safe * to follow its pointers. */ -static inline void list_del(struct list *elem) -{ - elem->n->p = elem->p; - elem->p->n = elem->n; -} +void list_del(struct list *elem); /* * Is the list empty? */ -static inline int list_empty(struct list *head) -{ - return head->n == head; -} +int list_empty(struct list *head); /* * Is this the first element of the list? */ -static inline int list_start(struct list *head, struct list *elem) -{ - return elem->p == head; -} +int list_start(struct list *head, struct list *elem); /* * Is this the last element of the list? */ -static inline int list_end(struct list *head, struct list *elem) -{ - return elem->n == head; -} +int list_end(struct list *head, struct list *elem); /* * Return first element of the list or NULL if empty */ -static inline struct list *list_first(struct list *head) -{ - return (list_empty(head) ? NULL : head->n); -} +struct list *list_first(struct list *head); /* * Return last element of the list or NULL if empty */ -static inline struct list *list_last(struct list *head) -{ - return (list_empty(head) ? NULL : head->p); -} +struct list *list_last(struct list *head); /* * Return the previous element of the list, or NULL if we've reached the start. */ -static inline struct list *list_prev(struct list *head, struct list *elem) -{ - return (list_start(head, elem) ? NULL : elem->p); -} +struct list *list_prev(struct list *head, struct list *elem); /* * Return the next element of the list, or NULL if we've reached the end. */ -static inline struct list *list_next(struct list *head, struct list *elem) -{ - return (list_end(head, elem) ? NULL : elem->n); -} +struct list *list_next(struct list *head, struct list *elem); /* * Given the address v of an instance of 'struct list' called 'head' @@ -244,15 +198,6 @@ static inline struct list *list_next(struct list *head, struct list *elem) /* * Return the number of elements in a list by walking it. */ -static inline unsigned int list_size(const struct list *head) -{ - unsigned int s = 0; - const struct list *v; - - list_iterate(v, head) - s++; - - return s; -} +unsigned int list_size(const struct list *head); #endif |