Module Name:    src
Committed By:   christos
Date:           Tue Nov 26 01:27:46 UTC 2013

Modified Files:
        src/sys/sys: queue.h

Log Message:
Provide TAILQ_REPLACE for tmux, from FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/sys/queue.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/sys/queue.h
diff -u src/sys/sys/queue.h:1.59 src/sys/sys/queue.h:1.60
--- src/sys/sys/queue.h:1.59	Sun Nov 24 22:02:57 2013
+++ src/sys/sys/queue.h	Mon Nov 25 20:27:46 2013
@@ -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 @@ struct {								\
 	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);					\

Reply via email to