From 1bb9ed4ffbbd1b186b30702d3c4104d5597d0888 Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Sat, 7 Feb 2009 18:35:53 +0000 Subject: Add list insert routines Add new list insertion routines list_insert_before(), list_insert_after(), and list_add_tail(). Also, change list_add() to use list_insert_after(). Signed-off-by: Geoff Levand Signed-off-by: Jeremy Kerr --- lib/list/list.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib/list/list.h') diff --git a/lib/list/list.h b/lib/list/list.h index 3858cf6..fe2c1d3 100644 --- a/lib/list/list.h +++ b/lib/list/list.h @@ -31,9 +31,17 @@ struct list { pos = list_entry(pos->member.next, typeof(*pos), member)) void list_init(struct list *list); - -void list_add(struct list *list, struct list_item *item); - +void list_insert_before(struct list_item *next, struct list_item *new); +void list_insert_after(struct list_item *prev, struct list_item *new); void list_remove(struct list_item *item); +static inline void list_add(struct list *list, struct list_item *new) +{ + list_insert_after(&list->head, new); +} +static inline void list_add_tail(struct list *list, struct list_item *new) +{ + list_insert_before(&list->head, new); +} + #endif /* _LIST_H */ -- cgit v1.2.1