libFirm
|
Doubly linked lists. More...
Macros | |
#define | LIST_HEAD_INIT(name) { &(name), &(name) } |
Static initializer for a list header. More... | |
#define | LIST_HEAD(name) struct list_head name = LIST_HEAD_INIT(name) |
Defines a (static) list reference. More... | |
#define | INIT_LIST_HEAD(ptr) |
Initializes a list header. More... | |
#define | list_entry(ptr, type, member) _list_container_of(ptr, type, member) |
list_entry - get the struct for this entry More... | |
#define | list_for_each(pos, head) for (pos = (head)->next; pos != (head); pos = pos->next) |
list_for_each - iterate over a list More... | |
#define | list_for_each_prev(pos, head) for (pos = (head)->prev; pos != (head); pos = pos->prev) |
list_for_each_prev - iterate over a list backwards More... | |
#define | list_for_each_safe(pos, n, head) |
list_for_each_safe - iterate over a list safe against removal of list entry More... | |
#define | list_for_each_entry(type, pos, head, member) |
list_for_each_entry - iterate over list of given type More... | |
#define | list_for_each_entry_reverse(type, pos, head, member) |
list_for_each_entry_reverse - iterate backwards over list of given type. More... | |
#define | list_for_each_entry_safe(type, pos, n, head, member) |
list_for_each_entry_safe - iterate over list of given type safe against removal of list entry More... | |
Typedefs | |
typedef struct list_head | list_head |
List Header. More... | |
Functions | |
static void | __list_add (struct list_head *new_node, struct list_head *prev, struct list_head *next) |
Inserts a new entry between two known consecutive entries. More... | |
static void | list_add (struct list_head *new_node, struct list_head *head) |
Adds a new entry. More... | |
static void | list_add_tail (struct list_head *new_node, struct list_head *head) |
Adds a new entry. More... | |
static void | __list_del (struct list_head *prev, struct list_head *next) |
Deletes a list entry by making the prev/next entries point to each other. More... | |
static void | list_del (struct list_head *entry) |
Deletes entry from list. More... | |
static void | list_del_init (struct list_head *entry) |
Deletes entry from list and reinitialize it. More... | |
static void | list_move (struct list_head *list, struct list_head *head) |
Deletes from one list and add as another's head. More... | |
static void | list_move_tail (struct list_head *list, struct list_head *head) |
Deletes from one list and add as another's tail. More... | |
static int | list_empty (const struct list_head *head) |
Tests whether a list is empty. More... | |
static void | __list_splice (struct list_head *list, struct list_head *head) |
Join two nonempty lists. More... | |
static void | list_splice (struct list_head *list, struct list_head *head) |
list_splice - join two lists More... | |
static void | list_splice_init (struct list_head *list, struct list_head *head) |
list_splice_init - join two lists and reinitialize the emptied list. More... | |
Doubly linked lists.
Simple doubly linked list implementation.
Some of the internal functions ("__xxx") are useful when manipulating whole lists rather than single entries, as sometimes we already know the next/prev entries and we can generate better code by using them directly rather than using the generic single-entry routines.
#define INIT_LIST_HEAD | ( | ptr | ) |
Initializes a list header.
Definition at line 39 of file list.h.
Referenced by list_del_init(), and list_splice_init().
#define list_entry | ( | ptr, | |
type, | |||
member | |||
) | _list_container_of(ptr, type, member) |
#define list_for_each | ( | pos, | |
head | |||
) | for (pos = (head)->next; pos != (head); pos = pos->next) |
#define list_for_each_entry | ( | type, | |
pos, | |||
head, | |||
member | |||
) |
list_for_each_entry - iterate over list of given type
type | the type of the struct where the listhead is embedded in |
pos | the type * to use as a loop counter. |
head | the head for your list. |
member | the name of the list_struct within the struct. |
#define list_for_each_entry_reverse | ( | type, | |
pos, | |||
head, | |||
member | |||
) |
list_for_each_entry_reverse - iterate backwards over list of given type.
type | the type of the struct where the listhead is embedded in |
pos | the type * to use as a loop counter. |
head | the head for your list. |
member | the name of the list_struct within the struct. |
#define list_for_each_entry_safe | ( | type, | |
pos, | |||
n, | |||
head, | |||
member | |||
) |
list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
type | the type of the struct where the listhead is embedded in |
pos | the type * to use as a loop counter. |
n | another type * to use as temporary storage |
head | the head for your list. |
member | the name of the list_struct within the struct. |
#define list_for_each_prev | ( | pos, | |
head | |||
) | for (pos = (head)->prev; pos != (head); pos = pos->prev) |
#define list_for_each_safe | ( | pos, | |
n, | |||
head | |||
) |
list_for_each_safe - iterate over a list safe against removal of list entry
pos | the &struct list_head to use as a loop counter. |
n | another &struct list_head to use as temporary storage |
head | the head for your list. |
#define LIST_HEAD | ( | name | ) | struct list_head name = LIST_HEAD_INIT(name) |
#define LIST_HEAD_INIT | ( | name | ) | { &(name), &(name) } |
|
inlinestatic |
Inserts a new entry between two known consecutive entries.
This is only for internal list manipulation where we know the prev/next entries already!
Definition at line 58 of file list.h.
Referenced by list_add(), and list_add_tail().
Deletes a list entry by making the prev/next entries point to each other.
This is only for internal list manipulation where we know the prev/next entries already!
Definition at line 101 of file list.h.
Referenced by list_del(), list_del_init(), list_move(), and list_move_tail().
Join two nonempty lists.
list
is possibly empty. list | the new list to add. |
head | the place to add it in the first list. |
Definition at line 172 of file list.h.
Referenced by list_splice(), and list_splice_init().
Adds a new entry.
new_node | new entry to be added |
head | list head to add it after |
Insert a new entry after the specified head. This is good for implementing stacks.
Definition at line 76 of file list.h.
References __list_add().
Referenced by list_move().
Adds a new entry.
new_node | new entry to be added |
head | list head to add it before |
Insert a new entry before the specified head. This is useful for implementing queues.
Definition at line 89 of file list.h.
References __list_add().
Referenced by list_move_tail().
|
inlinestatic |
Deletes entry from list.
entry | the element to delete from the list. |
Definition at line 115 of file list.h.
References __list_del().
|
inlinestatic |
Deletes entry from list and reinitialize it.
entry | the element to delete from the list. |
Definition at line 127 of file list.h.
References __list_del(), and INIT_LIST_HEAD.
|
inlinestatic |
Tests whether a list is empty.
head | the list to test. |
Definition at line 160 of file list.h.
Referenced by list_splice(), and list_splice_init().
Deletes from one list and add as another's head.
list | the entry to move |
head | the head that will precede our entry |
Definition at line 138 of file list.h.
References __list_del(), and list_add().
Deletes from one list and add as another's tail.
list | the entry to move |
head | the head that will follow our entry |
Definition at line 149 of file list.h.
References __list_del(), and list_add_tail().
list_splice - join two lists
list | the new list to add. |
head | the place to add it in the first list. |
Definition at line 191 of file list.h.
References __list_splice(), and list_empty().
list_splice_init - join two lists and reinitialize the emptied list.
list | the new list to add. |
head | the place to add it in the first list. |
The list at list is reinitialized
Definition at line 204 of file list.h.
References __list_splice(), INIT_LIST_HEAD, and list_empty().