ringbuffer: versatility and optimizations

This is my second take on #933, to make the ringbuffer more versatile.

* ~~This PR is rebased on #1099.~~
* It removes clutter from the code (but might need unit tests).
* It adds peek functionality, and helper functions to test if the ringbuffer is full/empty.
* It optimizes the parameter usage (`unsigned` types for lengths, `restrict`).
* It makes the implementation easier to understand by dropping the explicit pointer to the end of the buffer. This also strips `sizeof (void *)` bytes per ringbuffer.
* `ringbuffer_add()` won't overwrite existing content. `ringbuffer_get_one()` will tell what was overwritten.
* It adds the missing documentation for the library.

Please see the individual commits.
I'm still in favor of adding this as a unittest :-)