Add helper structure for reading from and writing into buffers

The logic behind the input and output buffers is quite intricate
and leads to numerous subtle bugs that are best handled with a
refactoring using an abstraction layer that hides most of the
gory details.

The Herodotus reader/writer elegantly does all the magic in the
background, allowing us to focus on the algorithms in the front
instead. This especially helps with handling NUL-terminated strings,
as we are guaranteed not to accidentally read too far.

Signed-off-by: Laslo Hunhold <dev@frign.de>
2 files changed