object: add generic byte-buffer data structure

This commit is contained in:
2025-04-11 13:56:09 +01:00
parent 640bf57b60
commit 0ddfb2ee3c
3 changed files with 369 additions and 10 deletions

17
object/buffer.h Normal file
View File

@@ -0,0 +1,17 @@
#ifndef _BLUELIB_BUFFER_H_
#define _BLUELIB_BUFFER_H_
#include "../object.h"
struct b_buffer {
struct b_object buf_base;
/* number of items in buffer */
unsigned int buf_len;
/* maximum number of items that can currently be stored in array */
unsigned int buf_cap;
/* the size of each individual item in the buffer */
unsigned int buf_itemsz;
void *buf_data;
};
#endif