Add STAILQ_FOREACH_MUTABLE.
authorHasso Tepper <hasso@dragonflybsd.org>
Thu, 28 Aug 2008 08:42:29 +0000 (08:42 +0000)
committerHasso Tepper <hasso@dragonflybsd.org>
Thu, 28 Aug 2008 08:42:29 +0000 (08:42 +0000)
sys/sys/queue.h

index a7b3962..c9761ce 100644 (file)
@@ -32,7 +32,7 @@
  *
  *     @(#)queue.h     8.5 (Berkeley) 8/20/94
  * $FreeBSD: src/sys/sys/queue.h,v 1.32.2.7 2002/04/17 14:21:02 des Exp $
- * $DragonFly: src/sys/sys/queue.h,v 1.10 2008/07/23 17:22:33 dillon Exp $
+ * $DragonFly: src/sys/sys/queue.h,v 1.11 2008/08/28 08:42:29 hasso Exp $
  */
 
 #ifndef _SYS_QUEUE_H_
  * _PREV               -       -       -       +       +
  * _LAST               -       -       +       +       +
  * _FOREACH            +       +       +       +       +
- * _FOREACH_MUTABLE    -       +       -       +       -
+ * _FOREACH_MUTABLE    -       +       +       +       -
  * _FOREACH_REVERSE    -       -       -       +       +
  * _INSERT_HEAD                +       +       +       +       +
  * _INSERT_BEFORE      -       +       -       +       +
@@ -215,6 +215,11 @@ struct {                                                           \
           (var);                                                       \
           (var) = STAILQ_NEXT((var), field))
 
+#define STAILQ_FOREACH_MUTABLE(var, head, field, tvar)                 \
+       for ((var) = STAILQ_FIRST((head));                              \
+           (var) && ((tvar) = STAILQ_NEXT((var), field), 1);           \
+           (var) = (tvar))
+
 #define        STAILQ_INIT(head) do {                                          \
        STAILQ_FIRST((head)) = NULL;                                    \
        (head)->stqh_last = &STAILQ_FIRST((head));                      \