Add FIRST/NEXT/LAST/PREV macros, analogous to sys/queue.h
This commit is contained in:
@@ -124,6 +124,23 @@ static UC_INLINE void uc_tailq_move_tail(struct TailQ *entry, struct TailQ *head
|
|||||||
uc_taiq_insert(entry, head->prev, head);
|
uc_taiq_insert(entry, head->prev, head);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FIRST/NEXT/LAST/PREV macros similar to sys/queue.h
|
||||||
|
//Note that unlike the standard TAILQ, you have to check
|
||||||
|
// == head instead of == NULL to determine if the tailq entry
|
||||||
|
// exists
|
||||||
|
|
||||||
|
#define UC_TAILQ_FIRST(head)\
|
||||||
|
((head)->next)
|
||||||
|
|
||||||
|
#define UC_TAILQ_NEXT(entry)\
|
||||||
|
((entry)->next)
|
||||||
|
|
||||||
|
#define UC_TAILQ_LAST(head)\
|
||||||
|
((head)->prev)
|
||||||
|
|
||||||
|
#define UC_TAILQ_PREV(entry)\
|
||||||
|
((entry)->prev)
|
||||||
|
|
||||||
/** Iterate over a tailq. The tailq cannot be altered while iterating.
|
/** Iterate over a tailq. The tailq cannot be altered while iterating.
|
||||||
*
|
*
|
||||||
* @param entry a struct TailQ* to which each element is assigned.
|
* @param entry a struct TailQ* to which each element is assigned.
|
||||||
|
|||||||
Reference in New Issue
Block a user