-
/**
* @file
* @brief Doubly linked lists.
#ifndef FIRM_ADT_LIST_H
#define FIRM_ADT_LIST_H
-#include "firm_config.h"
#include <stdlib.h>
+#include "../begin.h"
+
+typedef struct list_head list_head;
struct list_head {
struct list_head *next, *prev;
};
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
-static INLINE void __list_add(struct list_head *new_node,
+static inline void __list_add(struct list_head *new_node,
struct list_head *prev,
struct list_head *next)
{
* Insert a new entry after the specified head.
* This is good for implementing stacks.
*/
-static INLINE void list_add(struct list_head *new_node, struct list_head *head)
+static inline void list_add(struct list_head *new_node, struct list_head *head)
{
__list_add(new_node, head, head->next);
}
* Insert a new entry before the specified head.
* This is useful for implementing queues.
*/
-static INLINE void list_add_tail(struct list_head *new_node, struct list_head *head)
+static inline void list_add_tail(struct list_head *new_node, struct list_head *head)
{
__list_add(new_node, head->prev, head);
}
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
-static INLINE void __list_del(struct list_head * prev, struct list_head * next)
+static inline void __list_del(struct list_head * prev, struct list_head * next)
{
next->prev = prev;
prev->next = next;
* list_del - deletes entry from list.
* @param entry the element to delete from the list.
*
- * @Note
+ * @note
* list_empty on entry does not return true after this, the entry is
* in an undefined state.
*/
-static INLINE void list_del(struct list_head *entry)
+static inline void list_del(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
entry->next = NULL;
* list_del_init - deletes entry from list and reinitialize it.
* @param entry the element to delete from the list.
*/
-static INLINE void list_del_init(struct list_head *entry)
+static inline void list_del_init(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
INIT_LIST_HEAD(entry);
* @param list the entry to move
* @param head the head that will precede our entry
*/
-static INLINE void list_move(struct list_head *list, struct list_head *head)
+static inline void list_move(struct list_head *list, struct list_head *head)
{
__list_del(list->prev, list->next);
list_add(list, head);
* @param list the entry to move
* @param head the head that will follow our entry
*/
-static INLINE void list_move_tail(struct list_head *list,
+static inline void list_move_tail(struct list_head *list,
struct list_head *head)
{
__list_del(list->prev, list->next);
* list_empty - tests whether a list is empty
* @param head the list to test.
*/
-static INLINE int list_empty(const struct list_head *head)
+static inline int list_empty(const struct list_head *head)
{
return head->next == head;
}
-static INLINE void __list_splice(struct list_head *list,
+static inline void __list_splice(struct list_head *list,
struct list_head *head)
{
struct list_head *first = list->next;
* @param list the new list to add.
* @param head the place to add it in the first list.
*/
-static INLINE void list_splice(struct list_head *list, struct list_head *head)
+static inline void list_splice(struct list_head *list, struct list_head *head)
{
if (!list_empty(list))
__list_splice(list, head);
*
* The list at list is reinitialized
*/
-static INLINE void list_splice_init(struct list_head *list,
+static inline void list_splice_init(struct list_head *list,
struct list_head *head)
{
if (!list_empty(list)) {
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, type, member))
+#include "../end.h"
#endif