diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2011-01-12 16:13:45 +0100 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2011-01-12 16:14:16 +0100 |
commit | 1f3b5e311aefa6da262c11b4837aa65ab4c40490 (patch) | |
tree | 5c82e974e268b2354d2e3d0401bd5b88a9029c93 /common | |
parent | b2454c106703d31b8d352ff544f5a3d94dd6b048 (diff) |
common: add ring_get_length() for debugging purposes
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 |