Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys Provide TAILQ_REPLACE for tmux, from FreeBSD.



details:   https://anonhg.NetBSD.org/src/rev/c93ebcde2380
branches:  trunk
changeset: 791618:c93ebcde2380
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Nov 26 01:27:46 2013 +0000

description:
Provide TAILQ_REPLACE for tmux, from FreeBSD.

diffstat:

 sys/sys/queue.h |  14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r 253be0771a7c -r c93ebcde2380 sys/sys/queue.h
--- a/sys/sys/queue.h   Tue Nov 26 01:27:20 2013 +0000
+++ b/sys/sys/queue.h   Tue Nov 26 01:27:46 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: queue.h,v 1.59 2013/11/25 03:02:57 christos Exp $      */
+/*     $NetBSD: queue.h,v 1.60 2013/11/26 01:27:46 christos Exp $      */
 
 /*
  * Copyright (c) 1991, 1993
@@ -556,6 +556,18 @@
        QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field);                      \
 } while (/*CONSTCOND*/0)
 
+#define TAILQ_REPLACE(head, elm, elm2, field) do {                      \
+        if (((elm2)->field.tqe_next = (elm)->field.tqe_next) !=        \
+           TAILQ_END(head))                                            \
+                (elm2)->field.tqe_next->field.tqe_prev =                \ 
+                    &(elm2)->field.tqe_next;                            \
+        else                                                            \
+                (head)->tqh_last = &(elm2)->field.tqe_next;             \  
+        (elm2)->field.tqe_prev = (elm)->field.tqe_prev;                 \
+        *(elm2)->field.tqe_prev = (elm2);                               \ 
+       QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field);                      \
+} while (/*CONSTCOND*/0)
+
 #define        TAILQ_FOREACH(var, head, field)                                 \
        for ((var) = ((head)->tqh_first);                               \
            (var) != TAILQ_END(head);                                   \



Home | Main Index | Thread Index | Old Index