ooh okay diva
This commit is contained in:
parent
90175b7e26
commit
58ba150c93
17 changed files with 1122 additions and 94 deletions
21
next/core/dictionary.c
Normal file
21
next/core/dictionary.c
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue