提交 67a74148 编写于 作者: S Stefan Hajnoczi

queue: add QSIMPLEQ_PREPEND()

QSIMPLEQ_CONCAT(a, b) joins a = a + b.  The new QSIMPLEQ_PREPEND(a, b)
API joins a = b + a.
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
Message-id: 20180322152834.12656-2-stefanha@redhat.com
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
上级 f58d9620
......@@ -324,6 +324,14 @@ struct { \
} \
} while (/*CONSTCOND*/0)
#define QSIMPLEQ_PREPEND(head1, head2) do { \
if (!QSIMPLEQ_EMPTY((head2))) { \
*(head2)->sqh_last = (head1)->sqh_first; \
(head1)->sqh_first = (head2)->sqh_first; \
QSIMPLEQ_INIT((head2)); \
} \
} while (/*CONSTCOND*/0)
#define QSIMPLEQ_LAST(head, type, field) \
(QSIMPLEQ_EMPTY((head)) ? \
NULL : \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册