From 4ac7bee8070af6da71a48954db26ea95d591afe5 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Fri, 3 Dec 2010 16:07:50 +0000 Subject: [PATCH] Add SLIST_SWAP() macro. MFC after: 1 week --- sys/sys/queue.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/sys/queue.h b/sys/sys/queue.h index 257679bc058..f0bae8d9118 100644 --- a/sys/sys/queue.h +++ b/sys/sys/queue.h @@ -213,6 +213,12 @@ struct { \ SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \ } while (0) +#define SLIST_SWAP(head1, head2, type) do { \ + struct type *swap_first = SLIST_FIRST(head1); \ + SLIST_FIRST(head1) = SLIST_FIRST(head2); \ + SLIST_FIRST(head2) = swap_first; \ +} while (0) + /* * Singly-linked Tail queue declarations. */