Lines Matching refs:elt
29 #define INIT_LINK_TYPE(elt, link, type) \
31 (elt)->link.prev = (type *)(-1); \
32 (elt)->link.next = (type *)(-1); \
34 #define INIT_LINK(elt, link) \
35 INIT_LINK_TYPE(elt, link, void)
36 #define LINKED(elt, link) ((void *)((elt)->link.prev) != (void *)(-1))
42 #define PREPEND(list, elt, link) \
44 INSIST(!LINKED(elt, link));\
46 (list).head->link.prev = (elt); \
48 (list).tail = (elt); \
49 (elt)->link.prev = NULL; \
50 (elt)->link.next = (list).head; \
51 (list).head = (elt); \
54 #define APPEND(list, elt, link) \
56 INSIST(!LINKED(elt, link));\
58 (list).tail->link.next = (elt); \
60 (list).head = (elt); \
61 (elt)->link.prev = (list).tail; \
62 (elt)->link.next = NULL; \
63 (list).tail = (elt); \
66 #define UNLINK_TYPE(list, elt, link, type) \
68 INSIST(LINKED(elt, link));\
69 if ((elt)->link.next != NULL) \
70 (elt)->link.next->link.prev = (elt)->link.prev; \
72 (list).tail = (elt)->link.prev; \
73 if ((elt)->link.prev != NULL) \
74 (elt)->link.prev->link.next = (elt)->link.next; \
76 (list).head = (elt)->link.next; \
77 INIT_LINK_TYPE(elt, link, type); \
79 #define UNLINK(list, elt, link) \
80 UNLINK_TYPE(list, elt, link, void)
82 #define PREV(elt, link) ((elt)->link.prev)
83 #define NEXT(elt, link) ((elt)->link.next)
85 #define INSERT_BEFORE(list, before, elt, link) \
87 INSIST(!LINKED(elt, link));\
89 PREPEND(list, elt, link); \
91 (elt)->link.prev = (before)->link.prev; \
92 (before)->link.prev = (elt); \
93 (elt)->link.prev->link.next = (elt); \
94 (elt)->link.next = (before); \
98 #define INSERT_AFTER(list, after, elt, link) \
100 INSIST(!LINKED(elt, link));\
102 APPEND(list, elt, link); \
104 (elt)->link.next = (after)->link.next; \
105 (after)->link.next = (elt); \
106 (elt)->link.next->link.prev = (elt); \
107 (elt)->link.prev = (after); \
111 #define ENQUEUE(list, elt, link) APPEND(list, elt, link)
112 #define DEQUEUE(list, elt, link) UNLINK(list, elt, link)