diff options
author | Preston Pan <preston@nullring.xyz> | 2024-01-26 13:55:33 -0800 |
---|---|---|
committer | Preston Pan <preston@nullring.xyz> | 2024-01-26 13:55:33 -0800 |
commit | 20bd9521cd558e39eca4aac5f3db8e390f49ba2d (patch) | |
tree | ec7d99825c003ff5e06f224cd3c4009a5dde6d20 /src/stem.c | |
parent | 2750e54a2ad5afeabb7093fc10e9fb686b6f6059 (diff) |
Change README
Diffstat (limited to 'src/stem.c')
-rw-r--r-- | src/stem.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -447,16 +447,22 @@ ht_t *init_ht(size_t size) { } void ht_add(ht_t *h, string_t *key, void *v, void (*freefunc)(void *)) { + if (key == NULL) + return; sll_add(h->buckets[hash(h, key->value)], key, v, freefunc); } void *ht_get(ht_t *h, string_t *key) { + if (key == NULL) + return NULL; return sll_get(h->buckets[hash(h, key->value)], key); } bool ht_exists(ht_t *h, string_t *key) { return ht_get(h, key) != NULL; } void ht_delete(ht_t *h, string_t *key, void (*freefunc)(void *)) { + if (key == NULL) + return; sll_delete(h->buckets[hash(h, key->value)], key, freefunc); } |