diff --git a/include/ucore/tailq.h b/include/ucore/tailq.h index 3a4acda..f8e82f4 100644 --- a/include/ucore/tailq.h +++ b/include/ucore/tailq.h @@ -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); } +//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. * * @param entry a struct TailQ* to which each element is assigned.