summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorIan Moffett <ian@mirocom.org>2026-05-23 11:35:31 -0400
committerIan Moffett <ian@mirocom.org>2026-05-23 11:35:31 -0400
commit833978f41433c526b9614f8c772896a0bd6e31cc (patch)
tree2fc254f888f7dd80f4d34633539943327b943ab2 /include
parenta0b204fadd0ff2dae410e7b9e089de55cf1a4c47 (diff)
core: tokbuf: Dynamically expand token buffer
Signed-off-by: Ian Moffett <ian@mirocom.org>
Diffstat (limited to 'include')
-rw-r--r--include/cescal/tokbuf.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/cescal/tokbuf.h b/include/cescal/tokbuf.h
index 528cb02..61b80a3 100644
--- a/include/cescal/tokbuf.h
+++ b/include/cescal/tokbuf.h
@@ -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 */