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)
63#define A_SLIST_FOREACH(it, ctx) \
64 for (it = (ctx)->head.next; it; it = it->next)
72#define a_slist_forsafe(it, at, ctx) \
73 for (a_slist_node *at = &(ctx)->head, *it = at->next; \
74 it; at = it ? it : at, it = at->next)
75#define A_SLIST_FORSAFE(it, at, ctx) \
76 for (at = &(ctx)->head, it = at->next; it; \
77 at = it ? it : at, it = at->next)
85 ctx->head.next = A_NULL;
86 ctx->tail = &ctx->head;
95 ctx->head.next = A_NULL;
96 ctx->tail = &ctx->head;
105 ctx->head.next = A_NULL;
106 ctx->tail = &ctx->head;
124 if (!prev->next) { ctx->tail = node; }
162 if (!node->next) { ctx->tail = prev; }
176 if (!node->next) { ctx->tail = &ctx->head; }
191 if (!at->next) { to->tail = ctx->tail; }
void a_slist_ctor(a_slist *ctx)
constructor for singly linked list head
Definition slist.h:83
void a_slist_rot(a_slist *ctx)
rotate a node in the list
Definition slist.h:201
void a_slist_init(a_slist *ctx)
initialize for singly linked list head
Definition slist.h:93
void a_slist_mov(a_slist *ctx, a_slist *to, a_slist_node *at)
moving a list to another list
Definition slist.h:186
void a_slist_add_head(a_slist *ctx, a_slist_node *node)
insert a node to a list head
Definition slist.h:134
void a_slist_link(a_slist_node *head, a_slist_node *tail)
link head node and tail node
Definition slist.h:114
void a_slist_del_head(a_slist *ctx)
delete a node from a list head
Definition slist.h:170
void a_slist_del(a_slist *ctx, a_slist_node *prev)
delete a node from a list
Definition slist.h:156
void a_slist_dtor(a_slist *ctx)
destructor for singly linked list head
Definition slist.h:103
void a_slist_add_tail(a_slist *ctx, a_slist_node *node)
insert a node to a list tail
Definition slist.h:144
void a_slist_add(a_slist *ctx, a_slist_node *prev, a_slist_node *node)
insert a node to a list
Definition slist.h:122
instance structure for singly linked list node
Definition slist.h:26
instance structure for singly linked list head
Definition slist.h:42