From 847eb1a69b54da3a5d686922f0a2fcd8ab37f1e6 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 20 Aug 2025 23:27:04 +0100 Subject: Refactor vectors to SBO, removing inlined entirely. Avoid 2 levels of indirection, and having to allocate twice for small payloads, by having an inlined array on the vector directly! Beautiful and simple. Required a bit of refactoring around the board, but overall the result makes me feel happier. --- constructor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'constructor.c') diff --git a/constructor.c b/constructor.c index 910ed2a..9db0330 100644 --- a/constructor.c +++ b/constructor.c @@ -35,7 +35,7 @@ lisp_t *cons(sys_t *sys, lisp_t *car, lisp_t *cdr) lisp_t *make_vec(sys_t *sys, u64 capacity) { vec_t *vec = calloc(1, sizeof(*vec)); - vec_ensure_free(vec, MAX(capacity, VEC_DEFAULT_CAPACITY)); + vec_init(vec, capacity); lisp_t *ptr = tag_vec(vec); sys_register(sys, ptr); return ptr; @@ -43,6 +43,6 @@ lisp_t *make_vec(sys_t *sys, u64 capacity) lisp_t *intern(sys_t *sys, sv_t sv) { - sv_t *str = sym_table_find(&sys->symtable, sv); + char *str = sym_table_find(&sys->symtable, sv); return tag_sym(str); } -- cgit v1.2.3-13-gbd6f