Lines Matching refs:list
3 some simple double linked list macros
27 /* hook into the front of the list */
28 #define DLIST_ADD(list, p) \
30 if (!(list)) { \
31 (list) = (p); \
34 (list)->prev = (p); \
35 (p)->next = (list); \
37 (list) = (p); \
41 /* remove an element from a list - element doesn't have to be in list. */
42 #define DLIST_REMOVE(list, p) \
44 if ((p) == (list)) { \
45 (list) = (p)->next; \
46 if (list) (list)->prev = NULL; \
51 if ((p) && ((p) != (list))) (p)->next = (p)->prev = NULL; \
54 /* promote an element to the top of the list */
55 #define DLIST_PROMOTE(list, p) \
57 DLIST_REMOVE(list, p); \
58 DLIST_ADD(list, p); \
61 /* hook into the end of the list - needs the entry type */
62 #define DLIST_ADD_END(list, p, type) \
64 if (!(list)) { \
65 (list) = (p); \
69 for (tmp = (list); tmp->next; tmp = tmp->next) ; \
76 /* insert 'p' after the given element 'el' in a list. If el is NULL then
78 #define DLIST_ADD_AFTER(list, p, el) \
80 if (!(list) || !(el)) { \
81 DLIST_ADD(list, p); \
90 /* demote an element to the end of the list, needs the entry type */
91 #define DLIST_DEMOTE(list, p, type) \
93 DLIST_REMOVE(list, p); \
94 DLIST_ADD_END(list, p, type); \
97 /* concatenate two lists - putting all elements of the 2nd list at the
98 end of the first list */