Add a membuf_printf() function which supports writing a formatted string
into a membuf.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a way to set up a membuf with some pre-loaded data, so it is
possible to read it out using membuf_readline(), etc.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present the membuf implementation wastes a slot in the fifo so it can
detect the difference between a full and an empty buffer.
Add the option of supporting a boolean flag, if desired. For now it is
off.
The code-size penalty is non-zero, but the space penalty is small and
could be reduced on 64-bit machines by using a u32 offset for head and
tail.
Signed-off-by: Simon Glass <sjg@chromium.org>