]> andersk Git - openssh.git/blobdiff - openbsd-compat/sys-queue.h
- otto@cvs.openbsd.org 2005/10/17 20:19:42
[openssh.git] / openbsd-compat / sys-queue.h
index c49a9465099b1caf6934bfd8f1dead92d013d5d0..ee2ce30bfa2a38d5e756498544fd108f64bdb5a3 100644 (file)
@@ -1,6 +1,4 @@
-/* OPENBSD ORIGINAL: sys/sys/queue.h */
-
-/*     $OpenBSD: queue.h,v 1.25 2004/04/08 16:08:21 henning Exp $      */
+/*     $OpenBSD: queue.h,v 1.28 2005/10/17 20:19:42 otto Exp $ */
 /*     $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $       */
 
 /*
@@ -34,6 +32,8 @@
  *     @(#)queue.h     8.5 (Berkeley) 8/20/94
  */
 
+/* OPENBSD ORIGINAL: sys/sys/queue.h */
+
 #ifndef        _FAKE_QUEUE_H_
 #define        _FAKE_QUEUE_H_
 
@@ -229,13 +229,14 @@ struct {                                                          \
 #define SLIST_REMOVE(head, elm, type, field) do {                      \
        if ((head)->slh_first == (elm)) {                               \
                SLIST_REMOVE_HEAD((head), field);                       \
-       }                                                               \
-       else {                                                          \
+       } else {                                                        \
                struct type *curelm = (head)->slh_first;                \
-               while( curelm->field.sle_next != (elm) )                \
+                                                                       \
+               while (curelm->field.sle_next != (elm))                 \
                        curelm = curelm->field.sle_next;                \
                curelm->field.sle_next =                                \
                    curelm->field.sle_next->field.sle_next;             \
+               (elm)->field.sle_next = NULL;                           \
        }                                                               \
 } while (0)
 
@@ -303,6 +304,8 @@ struct {                                                            \
                (elm)->field.le_next->field.le_prev =                   \
                    (elm)->field.le_prev;                               \
        *(elm)->field.le_prev = (elm)->field.le_next;                   \
+       (elm)->field.le_prev = NULL;                                    \
+       (elm)->field.le_next = NULL;                                    \
 } while (0)
 
 #define LIST_REPLACE(elm, elm2, field) do {                            \
@@ -311,6 +314,8 @@ struct {                                                            \
                    &(elm2)->field.le_next;                             \
        (elm2)->field.le_prev = (elm)->field.le_prev;                   \
        *(elm2)->field.le_prev = (elm2);                                \
+       (elm)->field.le_prev = NULL;                                    \
+       (elm)->field.le_next = NULL;                                    \
 } while (0)
 
 /*
@@ -369,8 +374,8 @@ struct {                                                            \
        (listelm)->field.sqe_next = (elm);                              \
 } while (0)
 
-#define SIMPLEQ_REMOVE_HEAD(head, elm, field) do {                     \
-       if (((head)->sqh_first = (elm)->field.sqe_next) == NULL)        \
+#define SIMPLEQ_REMOVE_HEAD(head, field) do {                  \
+       if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
                (head)->sqh_last = &(head)->sqh_first;                  \
 } while (0)
 
@@ -465,6 +470,8 @@ struct {                                                            \
        else                                                            \
                (head)->tqh_last = (elm)->field.tqe_prev;               \
        *(elm)->field.tqe_prev = (elm)->field.tqe_next;                 \
+       (elm)->field.tqe_prev = NULL;                                   \
+       (elm)->field.tqe_next = NULL;                                   \
 } while (0)
 
 #define TAILQ_REPLACE(head, elm, elm2, field) do {                     \
@@ -475,6 +482,8 @@ struct {                                                            \
                (head)->tqh_last = &(elm2)->field.tqe_next;             \
        (elm2)->field.tqe_prev = (elm)->field.tqe_prev;                 \
        *(elm2)->field.tqe_prev = (elm2);                               \
+       (elm)->field.tqe_prev = NULL;                                   \
+       (elm)->field.tqe_next = NULL;                                   \
 } while (0)
 
 /*
@@ -575,6 +584,8 @@ struct {                                                            \
        else                                                            \
                (elm)->field.cqe_prev->field.cqe_next =                 \
                    (elm)->field.cqe_next;                              \
+       (elm)->field.cqe_next = NULL;                                   \
+       (elm)->field.cqe_prev = NULL;                                   \
 } while (0)
 
 #define CIRCLEQ_REPLACE(head, elm, elm2, field) do {                   \
@@ -588,6 +599,8 @@ struct {                                                            \
                (head).cqh_first = (elm2);                              \
        else                                                            \
                (elm2)->field.cqe_prev->field.cqe_next = (elm2);        \
+       (elm)->field.cqe_next = NULL;                                   \
+       (elm)->field.cqe_prev = NULL;                                   \
 } while (0)
 
 #endif /* !_FAKE_QUEUE_H_ */
This page took 0.074012 seconds and 4 git commands to generate.