ooh okay diva

This commit is contained in:
Lobo 2026-02-08 10:03:56 -03:00
parent 90175b7e26
commit 58ba150c93
17 changed files with 1122 additions and 94 deletions

21
next/core/dictionary.c Normal file
View file

@ -0,0 +1,21 @@
#include <growl.h>
#include <string.h>
GrowlDictionary *growl_dictionary_upsert(GrowlDictionary **dict,
const char *name, GrowlArena *perm) {
size_t len = strlen(name);
for (uint64_t h = growl_hash_bytes((uint8_t *)name, len); *dict; h <<= 2) {
if (strcmp(name, (*dict)->name) == 0) {
return *dict;
}
dict = &(*dict)->child[h >> 62];
}
if (!perm) {
return NULL;
}
*dict = growl_arena_new(perm, GrowlDictionary, 1);
(*dict)->name = name;
return *dict;
}