Provide TAILQ_REPLACE for tmux, from FreeBSD.
This commit is contained in:
parent
6b6949f4cd
commit
05617891c6
|
@ -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); \
|
||||
|
|
Loading…
Reference in New Issue