shl: ring: add shl_ring_flush() helper

This helper flushes all messages from the ring buffer and releases the
memory.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-10-29 20:34:52 +01:00
parent 9cc9008866
commit b626a85206

View File

@ -184,4 +184,19 @@ next:
}
}
static inline void shl_ring_flush(struct shl_ring *ring)
{
struct shl_ring_entry *tmp;
if (!ring)
return;
while (ring->first) {
tmp = ring->first;
ring->first = tmp->next;
free(tmp);
}
ring->last = NULL;
}
#endif /* SHL_RING_H */