diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-08-20 23:27:04 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-08-20 23:37:08 +0100 |
commit | 847eb1a69b54da3a5d686922f0a2fcd8ab37f1e6 (patch) | |
tree | 057d4c1ca6f478a2909d0ee271d2bb8ff0f25c2f /constructor.c | |
parent | 13142dc7f38e6b148efadc97edffca8664b9cde7 (diff) | |
download | alisp-847eb1a69b54da3a5d686922f0a2fcd8ab37f1e6.tar.gz alisp-847eb1a69b54da3a5d686922f0a2fcd8ab37f1e6.tar.bz2 alisp-847eb1a69b54da3a5d686922f0a2fcd8ab37f1e6.zip |
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.
Diffstat (limited to 'constructor.c')
-rw-r--r-- | constructor.c | 4 |
1 files changed, 2 insertions, 2 deletions
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); } |