cleanup
This commit is contained in:
+14
-14
@@ -8,8 +8,8 @@
|
||||
|
||||
#define tailq_link(type) \
|
||||
struct { \
|
||||
type* tqe_next; \
|
||||
type** tqe_prev; \
|
||||
type* tql_next; \
|
||||
type** tql_prev; \
|
||||
}
|
||||
|
||||
#define tailq_init(head) \
|
||||
@@ -20,33 +20,33 @@
|
||||
|
||||
#define tailq_first(head) ((head)->tqh_first)
|
||||
|
||||
#define tailq_next(elm, field) ((elm)->field.tqe_next)
|
||||
#define tailq_next(elm, field) ((elm)->field.tql_next)
|
||||
|
||||
#define tailq_empty(head) (tailq_first(head) == nullptr)
|
||||
|
||||
#define tailq_insert_tail(head, elm, field) \
|
||||
do { \
|
||||
(elm)->field.tqe_next = nullptr; \
|
||||
(elm)->field.tqe_prev = (head)->tqh_last; \
|
||||
(elm)->field.tql_next = nullptr; \
|
||||
(elm)->field.tql_prev = (head)->tqh_last; \
|
||||
*(head)->tqh_last = (elm); \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
(head)->tqh_last = &(elm)->field.tql_next; \
|
||||
} while (0)
|
||||
|
||||
#define tailq_insert_head(head, elm, field) \
|
||||
do { \
|
||||
if (((elm)->field.tqe_next = (head)->tqh_first) != nullptr) \
|
||||
(head)->tqh_first->field.tqe_prev = &(elm)->field.tqe_next; \
|
||||
if (((elm)->field.tql_next = (head)->tqh_first) != nullptr) \
|
||||
(head)->tqh_first->field.tql_prev = &(elm)->field.tql_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
(head)->tqh_last = &(elm)->field.tql_next; \
|
||||
(head)->tqh_first = (elm); \
|
||||
(elm)->field.tqe_prev = &(head)->tqh_first; \
|
||||
(elm)->field.tql_prev = &(head)->tqh_first; \
|
||||
} while (0)
|
||||
|
||||
#define tailq_remove(head, elm, field) \
|
||||
do { \
|
||||
if (((elm)->field.tqe_next) != nullptr) \
|
||||
(elm)->field.tqe_next->field.tqe_prev = (elm)->field.tqe_prev; \
|
||||
if (((elm)->field.tql_next) != nullptr) \
|
||||
(elm)->field.tql_next->field.tql_prev = (elm)->field.tql_prev; \
|
||||
else \
|
||||
(head)->tqh_last = (elm)->field.tqe_prev; \
|
||||
*(elm)->field.tqe_prev = (elm)->field.tqe_next; \
|
||||
(head)->tqh_last = (elm)->field.tql_prev; \
|
||||
*(elm)->field.tql_prev = (elm)->field.tql_next; \
|
||||
} while (0)
|
||||
|
||||
Reference in New Issue
Block a user