core: tokbuf: Dynamically expand token buffer

Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
2026-05-23 11:35:31 -04:00
parent a0b204fadd
commit 833978f414
3 changed files with 40 additions and 4 deletions
+9 -1
View File
@@ -13,7 +13,8 @@
#define TOKBUF_CAP 4
struct tokbuf {
struct token buf[TOKBUF_CAP];
struct token *buf;
size_t cap;
uint8_t head;
};
@@ -47,4 +48,11 @@ int tokbuf_push(struct tokbuf *tokbuf, struct token *tok);
*/
int tokbuf_noff(struct tokbuf *tokbuf, size_t noff, struct token *res);
/*
* Destroy a token buffer
*
* @tokbuf: Token buffer to destroy
*/
void tokbuf_destroy(struct tokbuf *tokbuf);
#endif /* !CESCAL_TOKBUF_H */