add assignment operator and unify memory pools

The unification of memory pools also fixed some memory leaks and
hopefully reduced the mallocs of identifier strings significantly by
giving them the same pool as the token stream.
This commit is contained in:
r4
2021-12-21 11:40:49 +01:00
parent 21694f98ac
commit 63af3e907b
11 changed files with 121 additions and 48 deletions

2
map.c
View File

@@ -85,7 +85,7 @@ bool map_insert(Map *m, const char *key, const void *val) {
return replaced;
}
bool map_get(Map *m, const char *key, void *out_val) {
bool map_get(const Map *m, const char *key, void *out_val) {
size_t idx = fnv1a32(key, strlen(key)) & (m->cap - 1);
for (;;) {
if (m->slots[idx].empty)