commit b831c3fcf661a1ff09676f380ab834837641b6de
parent bd3fb015324082dd3ddbd98800ef0f6764e0ee47
Author: lash <dev@holbrook.no>
Date: Mon, 3 Mar 2025 00:55:26 +0000
Finish implementing mem module
Diffstat:
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/store/mem.c b/src/store/mem.c
@@ -48,19 +48,25 @@ static long unsigned int pair_hash(const void *item, long unsigned int s0, long
return (unsigned int)hashmap_sip(o->key, o->key_len, s0, s1);
}
-void lq_mem_init(LQStore *store) {
+struct hashmap* lq_mem_init(LQStore *store) {
if (store->userdata == NULL) {
store->userdata = (void*)hashmap_new(sizeof(struct pair_t) , 0, 0, 0, pair_hash, pair_cmp, NULL, NULL);
}
+ return (struct hashmap *)store->userdata;
}
int lq_mem_content_get(enum payload_e typ, LQStore *store, const char *key, size_t key_len, char *value, size_t *value_len) {
- lq_mem_init(store);
+ struct hashmap *o;
+
+ o = lq_mem_init(store);
return ERR_OK;
}
int lq_mem_content_put(enum payload_e typ, LQStore *store, const char *key, size_t *key_len, char *value, size_t value_len) {
- lq_mem_init(store);
+ struct hashmap *o;
+
+ o = lq_mem_init(store);
+ hashmap_set(store.userdata);
return ERR_OK;
}