buf: add short dynamic buffer helper

shl_buf is a very basic dynamicly growing buffer for arbitrary data. Push
and Pull operations are supported.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
ring: add shl_ring_flush()

shl_ring_flush() empties the buffer but keeps the allocated ring buffer.
Can be used if the buffer is about to be re-used and not destroyed.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
ring: rename *_pop() to *_pull()

pop() is an operation on a stack which removes data from the top. However,
a ring buffer is basically a queue so we remove data from the tail. Rename
it to pull() to make it more obvious.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
ring: add shl_ring_copy() helper

This helper extracts data from a ring buffer. It is allocated separately
and linearizes it. It is not removed from the ring itself. Use pull()
separately.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
ring: add shl_ring_length() helper

Small helper to return the actual length of the current buffer data.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>