diff options
Diffstat (limited to 'include/serd/buffer.h')
-rw-r--r-- | include/serd/buffer.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/include/serd/buffer.h b/include/serd/buffer.h index 20abfb29..a56188e7 100644 --- a/include/serd/buffer.h +++ b/include/serd/buffer.h @@ -5,6 +5,7 @@ #define SERD_BUFFER_H #include "serd/attributes.h" +#include "serd/memory.h" #include "zix/attributes.h" #include <stddef.h> @@ -23,18 +24,19 @@ SERD_BEGIN_DECLS @{ */ -/// A mutable buffer in memory +/// A dynamically resizable mutable buffer in memory typedef struct { - void* ZIX_NULLABLE buf; ///< Buffer - size_t len; ///< Size of buffer in bytes + SerdAllocator* ZIX_NULLABLE allocator; ///< Allocator for buf + void* ZIX_NULLABLE buf; ///< Buffer + size_t len; ///< Size of buffer in bytes } SerdBuffer; /** A function for writing to a buffer, resizing it if necessary. This function can be used as a #SerdWriteFunc to write to a #SerdBuffer - which is resized as necessary with realloc(). The `stream` parameter must - point to an initialized #SerdBuffer. + which is reallocated as necessary. The `stream` parameter must point to an + initialized #SerdBuffer. Note that when writing a string, the string in the buffer will not be null-terminated until serd_buffer_close() is called. |