blob: db6474eeb05cf595c6a41bd93e972e0d454de9ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#ifndef TSL_BUFFER_H
#define TSL_BUFFER_H
#include <stddef.h>
/*
TODO: Optimize small size buffers by using data and size members (16 bytes on x86)
instead of heap allocation
*/
typedef struct {
void *data;
size_t size;
size_t capacity;
} TslBuffer;
void tsl_buffer_init(TslBuffer *self);
void tsl_buffer_deinit(TslBuffer *self);
int tsl_buffer_append(TslBuffer *self, const void *data, size_t size);
void* tsl_buffer_begin(TslBuffer *self);
void* tsl_buffer_end(TslBuffer *self);
#endif /* TSL_BUFFER_H */
|