diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/ring.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/common/ring.h b/common/ring.h index 3013f6e..b22e499 100644 --- a/common/ring.h +++ b/common/ring.h @@ -133,5 +133,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 |