add CIRCLEQ_LOOP_{NEXT,PREV}(), as discussed (briefly) a while ago

on tech-userlevel
This commit is contained in:
pooka 2006-03-07 17:56:00 +00:00
parent 5f64ff8fb1
commit b28fd3a188

View File

@ -1,4 +1,4 @@
/* $NetBSD: queue.h,v 1.44 2005/11/11 15:04:04 yamt Exp $ */
/* $NetBSD: queue.h,v 1.45 2006/03/07 17:56:00 pooka Exp $ */
/*
* Copyright (c) 1991, 1993
@ -658,4 +658,13 @@ struct { \
#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
#define CIRCLEQ_LOOP_NEXT(head, elm, field) \
(((elm)->field.cqe_next == (void *)(head)) \
? ((head)->cqh_first) \
: (elm->field.cqe_next))
#define CIRCLEQ_LOOP_PREV(head, elm, field) \
(((elm)->field.cqe_prev == (void *)(head)) \
? ((head)->cqh_last) \
: (elm->field.cqe_prev))
#endif /* !_SYS_QUEUE_H_ */