Buffer¶
A dynamically growing buffer storing arbitrary data.
Note
Used for Register, not Text content.
Functions
-
bool buffer_put(Buffer*, const void *data, size_t len)¶
Set buffer content, growing the buffer as needed.
-
bool buffer_insert(Buffer*, size_t pos, const void *data, size_t len)¶
Insert
len
bytes ofdata
atpos
.
- bool buffer_printf (Buffer *, const char *fmt,...) __attribute__((format(printf
Set formatted buffer content, ensures NUL termination on success.
- bool bool buffer_appendf (Buffer *, const char *fmt,...) __attribute__((format(printf
Append formatted buffer content, ensures NUL termination on success.
- bool bool size_t buffer_length0 (Buffer *)
Return length of a buffer without trailing NUL byte.
-
const char *buffer_content0(Buffer*)¶
Get pointer to buffer data.
Guaranteed to return a NUL terminated string even if buffer is empty.
-
struct Buffer¶
- #include <buffer.h>
A dynamically growing buffer storing arbitrary data.