add CIRCLEQ_LOOP_{NEXT,PREV}(), as discussed (briefly) a while ago
on tech-userlevel
This commit is contained in:
parent
5f64ff8fb1
commit
b28fd3a188
@ -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_ */
|
||||
|
Loading…
Reference in New Issue
Block a user