libmetal  353
List Primitives

Data Structures

struct  metal_list
 

Macros

#define METAL_INIT_LIST(name)   { .next = &name, .prev = &name }
 
#define METAL_DECLARE_LIST(name)    struct metal_list name = METAL_INIT_LIST(name)
 
#define metal_list_for_each(list, node)
 Used for iterating over a list. More...
 
#define metal_list_for_each_safe(list, temp, node)
 Used for iterating over a list safely. More...
 

Functions

static void metal_list_init (struct metal_list *list)
 
static void metal_list_add_before (struct metal_list *node, struct metal_list *new_node)
 
static void metal_list_add_after (struct metal_list *node, struct metal_list *new_node)
 
static void metal_list_add_head (struct metal_list *list, struct metal_list *node)
 
static void metal_list_add_tail (struct metal_list *list, struct metal_list *node)
 
static int metal_list_is_empty (struct metal_list *list)
 
static void metal_list_del (struct metal_list *node)
 
static struct metal_listmetal_list_first (struct metal_list *list)
 
static bool metal_list_find_node (struct metal_list *list, struct metal_list *node)
 

Detailed Description

Macro Definition Documentation

◆ METAL_DECLARE_LIST

#define METAL_DECLARE_LIST (   name)     struct metal_list name = METAL_INIT_LIST(name)

◆ METAL_INIT_LIST

#define METAL_INIT_LIST (   name)    { .next = &name, .prev = &name }

◆ metal_list_for_each

#define metal_list_for_each (   list,
  node 
)
Value:
for ((node) = (list)->next; \
(node) != (list); \
(node) = (node)->next)

Used for iterating over a list.

Parameters
listPointer to the head node of the list
nodePointer to each node in the list during iteration

◆ metal_list_for_each_safe

#define metal_list_for_each_safe (   list,
  temp,
  node 
)
Value:
for ((node) = (list)->next, (temp) = (node)->next; \
(node) != (list); \
(node) = (temp), (temp) = (node)->next)

Used for iterating over a list safely.

Parameters
listPointer to the head node of the list
tempPointer to the next node's address during iteration
nodePointer to each node in the list during iteration

Function Documentation

◆ metal_list_add_after()

static void metal_list_add_after ( struct metal_list node,
struct metal_list new_node 
)
inlinestatic

◆ metal_list_add_before()

static void metal_list_add_before ( struct metal_list node,
struct metal_list new_node 
)
inlinestatic

◆ metal_list_add_head()

static void metal_list_add_head ( struct metal_list list,
struct metal_list node 
)
inlinestatic

◆ metal_list_add_tail()

static void metal_list_add_tail ( struct metal_list list,
struct metal_list node 
)
inlinestatic

◆ metal_list_del()

static void metal_list_del ( struct metal_list node)
inlinestatic

◆ metal_list_find_node()

static bool metal_list_find_node ( struct metal_list list,
struct metal_list node 
)
inlinestatic

◆ metal_list_first()

static struct metal_list* metal_list_first ( struct metal_list list)
inlinestatic

◆ metal_list_init()

static void metal_list_init ( struct metal_list list)
inlinestatic

◆ metal_list_is_empty()

static int metal_list_is_empty ( struct metal_list list)
inlinestatic