aboutsummaryrefslogtreecommitdiff
path: root/symtable.c
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2025-08-20 21:50:58 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2025-08-20 21:50:58 +0100
commitdf558da7e1979a59b5207c323962aa59b61258e4 (patch)
tree99a69d572b536a5632a687a580db25e9735ffe3c /symtable.c
parent643896e2c8a2a9088819d3410f94008a83f575c6 (diff)
downloadalisp-df558da7e1979a59b5207c323962aa59b61258e4.tar.gz
alisp-df558da7e1979a59b5207c323962aa59b61258e4.tar.bz2
alisp-df558da7e1979a59b5207c323962aa59b61258e4.zip
Use sv_t instead of raw char*
We're storing them as sv_t's anyway, we're fucked with regards to indirection. Thus, let's be nice to ourselves, and deal with the structures. We get the size of the structure for free anyway!
Diffstat (limited to 'symtable.c')
-rw-r--r--symtable.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/symtable.c b/symtable.c
index 441dad8..e704a27 100644
--- a/symtable.c
+++ b/symtable.c
@@ -32,9 +32,9 @@ void sym_table_init(sym_table_t *table)
vec_make((void **)&table->entries, table->capacity * sizeof(*table->entries));
}
-char *sym_table_find(sym_table_t *table, sv_t sv)
+sv_t *sym_table_find(sym_table_t *table, sv_t sv)
{
- // TODO: Deal with resizing this when table->count > table->size / 2
+ // WIP: Deal with resizing this when table->count > table->size / 2
u64 index = djb2(sv) & (table->capacity - 1);
for (sv_t comp = table->entries[index]; comp.data; index += 1,
@@ -51,7 +51,7 @@ char *sym_table_find(sym_table_t *table, sv_t sv)
++table->count;
}
- return table->entries[index].data;
+ return table->entries + index;
}
void sym_table_cleanup(sym_table_t *table)