[Spice-devel] [PATCH spice-common 3/6] ring: add ring_add_tail

Yonit Halperin yhalperi at redhat.com
Sun Apr 8 08:42:35 PDT 2012


Signed-off-by: Yonit Halperin <yhalperi at redhat.com>
---
 common/ring.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/common/ring.h b/common/ring.h
index 7fba50e..7163aaa 100644
--- a/common/ring.h
+++ b/common/ring.h
@@ -61,6 +61,16 @@ static inline void ring_add(Ring *ring, RingItem *item)
     ring->next = item->next->prev = item;
 }
 
+static inline void ring_add_tail(Ring *ring, RingItem *item)
+{
+    spice_assert(ring->next != NULL && ring->prev != NULL);
+    spice_assert(item->next == NULL && item->prev == NULL);
+
+    item->next = ring;
+    item->prev = ring->prev;
+    ring->prev = item->prev->next = item;
+}
+
 static inline void ring_add_after(RingItem *item, RingItem *pos)
 {
     ring_add(pos, item);
-- 
1.7.7.6



More information about the Spice-devel mailing list