diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2018-03-22 15:28:32 +0000 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2018-03-27 13:05:28 +0100 |
commit | 67a74148d8828f611fc5a7a23277b8eceb4c9430 (patch) | |
tree | 81cbfec58a0a8ab1062fda7b044306f5af1a4594 /include/qemu/queue.h | |
parent | f58d9620aa4a514b1227074ff56eefd1334a6225 (diff) | |
download | qemu-67a74148d8828f611fc5a7a23277b8eceb4c9430.zip qemu-67a74148d8828f611fc5a7a23277b8eceb4c9430.tar.gz qemu-67a74148d8828f611fc5a7a23277b8eceb4c9430.tar.bz2 |
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: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20180322152834.12656-2-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'include/qemu/queue.h')
-rw-r--r-- | include/qemu/queue.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/qemu/queue.h b/include/qemu/queue.h index aa270d2..59fd120 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -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 : \ |