18#define A_SLIST_NODE {A_NULL}
19#define A_SLIST_INIT(list) {{A_NULL}, &(list).head}
36#define a_slist_(_, x) a_cast_s(a_slist_node _, a_cast_s(void _, x))
53#define a_slist_entry(ptr, type, member) a_container_of(ptr, type, member)
54#define a_slist_entry_next(ptr, type, member) a_slist_entry((ptr)->next, type, member)
61#define a_slist_foreach(it, ctx) \
62 for (a_slist_node *it = (ctx)->head.next; it; it = it->next)
70#define a_slist_forsafe(it, at, ctx) \
71 for (a_slist_node *at = &(ctx)->head, *it = at->next; \
72 it; at = it ? it : at, it = at->next)
80 ctx->head.next = A_NULL;
81 ctx->tail = &ctx->head;
90 ctx->head.next = A_NULL;
91 ctx->tail = &ctx->head;
100 ctx->head.next = A_NULL;
101 ctx->tail = &ctx->head;
119 if (!prev->next) { ctx->tail = node; }
157 if (!node->next) { ctx->tail = prev; }
171 if (!node->next) { ctx->tail = &ctx->head; }
186 if (!at->next) { to->tail = ctx->tail; }
void a_slist_ctor(a_slist *ctx)
constructor for singly linked list head
Definition slist.h:78
void a_slist_rot(a_slist *ctx)
rotate a node in the list
Definition slist.h:196
void a_slist_init(a_slist *ctx)
initialize for singly linked list head
Definition slist.h:88
void a_slist_mov(a_slist *ctx, a_slist *to, a_slist_node *at)
moving a list to another list
Definition slist.h:181
struct a_slist a_slist
instance structure for singly linked list head
void a_slist_add_head(a_slist *ctx, a_slist_node *node)
insert a node to a list head
Definition slist.h:129
void a_slist_link(a_slist_node *head, a_slist_node *tail)
link head node and tail node
Definition slist.h:109
void a_slist_del_head(a_slist *ctx)
delete a node from a list head
Definition slist.h:165
void a_slist_del(a_slist *ctx, a_slist_node *prev)
delete a node from a list
Definition slist.h:151
void a_slist_dtor(a_slist *ctx)
destructor for singly linked list head
Definition slist.h:98
void a_slist_add_tail(a_slist *ctx, a_slist_node *node)
insert a node to a list tail
Definition slist.h:139
struct a_slist_node a_slist_node
instance structure for singly linked list node
void a_slist_add(a_slist *ctx, a_slist_node *prev, a_slist_node *node)
insert a node to a list
Definition slist.h:117
instance structure for singly linked list node
Definition slist.h:26
instance structure for singly linked list head
Definition slist.h:42