#include "readbuf.h" // Populate a read buffer with a pointer to a string. void readbuf_populate(ReadBuf *buf, u8 *string) { buf->mem = string; buf->p = 0; } // Read the next byte of a read buffer, or zero if all bytes have been read. u8 readbuf_read(ReadBuf *buf) { u8 output = buf->mem[buf->p]; if (output) buf->p++; return output; } // Move the pointer to the start of the buffer. void readbuf_set_pointer(ReadBuf *buf) { buf->p = 0; }