Add LIST_FOREACH_MUTABLE which works like TAILQ_FOREACH_MUTABLE.
authorJoerg Sonnenberger <joerg@dragonflybsd.org>
Thu, 12 Aug 2004 14:57:29 +0000 (14:57 +0000)
committerJoerg Sonnenberger <joerg@dragonflybsd.org>
Thu, 12 Aug 2004 14:57:29 +0000 (14:57 +0000)
sys/sys/queue.h

index 0d40541..f373bc6 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.5 2004/04/10 00:48:06 hsu Exp $
+ * $DragonFly: src/sys/sys/queue.h,v 1.6 2004/08/12 14:57:29 joerg Exp $
  */
 
 #ifndef _SYS_QUEUE_H_
@@ -289,6 +289,11 @@ struct {                                                           \
            (var);                                                      \
            (var) = LIST_NEXT((var), field))
 
+#define        LIST_FOREACH_MUTABLE(var, head, field, nvar)                    \
+       for ((var) = LIST_FIRST((head));                                \
+            (var) && ((nvar) = LIST_NEXT((var), field), (var));        \
+            (var) = (nvar))
+
 #define        LIST_INIT(head) do {                                            \
        LIST_FIRST((head)) = NULL;                                      \
 } while (0)