12345678910111213141516171819 |
- #ifndef CORE_BUFFER_H
- #define CORE_BUFFER_H
- #include <stddef.h>
- typedef struct {
- size_t size;
- size_t capacity;
- char* buffer;
- } Buffer;
- void initBuffer(Buffer* b);
- void destroyBuffer(Buffer* b);
- void addSizedBufferData(Buffer* b, const void* data, size_t size);
- #define addTypedBufferData(buffer, type, ...) \
- addSizedBufferData(buffer, &(type){__VA_ARGS__}, sizeof(type))
- void clearBuffer(Buffer* b);
- #endif
|