From 2f0e2397bd8e879bd109a969deb4a56fbb7f12b2 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Mon, 14 Aug 2017 17:06:14 +0200 Subject: [PATCH] Add function _swap --- m-i-list.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/m-i-list.h b/m-i-list.h index 43f914a0..9d3155c4 100644 --- a/m-i-list.h +++ b/m-i-list.h @@ -439,5 +439,16 @@ typedef struct ilist_head_s { ILISTI_CONTRACT(name, nv); \ ILISTI_CONTRACT(name, ov); \ } \ - + \ + static inline void \ + M_C(name, _swap)(list_t d, list_t e) \ + { \ + ILISTI_CONTRACT(name, d); \ + ILISTI_CONTRACT(name, e); \ + M_SWAP(struct ilist_head_s *, d->name.next, e->name.next); \ + M_SWAP(struct ilist_head_s *, d->name.prev, e->name.prev); \ + ILISTI_CONTRACT(name, d); \ + ILISTI_CONTRACT(name, e); \ + } \ + #endif