[Spice-devel] [PATCH 7/9] common: add ring_get_length() for debugging purposes
Marc-André Lureau
marcandre.lureau at redhat.com
Tue Jan 25 10:17:26 PST 2011
---
common/ring.h | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/common/ring.h b/common/ring.h
index cdfe7e1..0194959 100644
--- a/common/ring.h
+++ b/common/ring.h
@@ -136,5 +136,18 @@ static inline RingItem *ring_prev(Ring *ring, RingItem *pos)
return (ret == ring) ? NULL : ret;
}
+static inline unsigned int ring_get_length(Ring *ring)
+{
+ RingItem *i;
+ unsigned int ret = 0;
+
+ for (i = ring_get_head(ring);
+ i != NULL;
+ i = ring_next(ring, i))
+ ret++;
+
+ return ret;
+}
+
#endif
--
1.7.3.4
More information about the Spice-devel
mailing list