more code

This commit is contained in:
Hongze Cheng 2024-02-19 16:01:20 +08:00
parent 0c419d7ed1
commit a8e9407375
2 changed files with 9 additions and 1 deletions

View File

@ -27,7 +27,8 @@ typedef struct SBufferWriter SBufferWriter;
typedef struct SBufferReader SBufferReader;
// SBuffer
#define tBufferInit() ((SBuffer){0, 0, NULL})
#define BUFFER_INITILIZER ((SBuffer){0, 0, NULL})
static int32_t tBufferInit(SBuffer *buffer);
static int32_t tBufferDestroy(SBuffer *buffer);
static int32_t tBufferEnsureCapacity(SBuffer *buffer, uint32_t capacity);
#define tBufferGetSize(buffer) ((buffer)->size)

View File

@ -35,6 +35,13 @@ struct SBufferReader {
};
// SBuffer
static FORCE_INLINE int32_t tBufferInit(SBuffer *buffer) {
buffer->size = 0;
buffer->capacity = 0;
buffer->data = NULL;
return 0;
}
static FORCE_INLINE int32_t tBufferDestroy(SBuffer *buffer) {
buffer->size = 0;
buffer->capacity = 0;