diff options
| author | Mosder <git@mosder.eu> | 2026-09-14 12:16:31 +0200 |
|---|---|---|
| committer | Mosder <git@mosder.eu> | 2026-09-14 12:16:31 +0200 |
| commit | d9ca02ef581c5f58957f83c5cad35ad99b00729f (patch) | |
| tree | 5ffcc252158e6b7a2f18208b520f996a06acdc25 /include | |
| parent | 74c6cbf6d883b88646c96cf46abd5ab87c36d509 (diff) | |
fix: removed const from where it shouldn't be and added a free fix for a specific concurrent operation on a hashmap - it still is not recommended, but this one is free, so might as well
Diffstat (limited to 'include')
| -rw-r--r-- | include/moslib/ds/hashmap.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/moslib/ds/hashmap.h b/include/moslib/ds/hashmap.h index d299b58..0b25be1 100644 --- a/include/moslib/ds/hashmap.h +++ b/include/moslib/ds/hashmap.h @@ -193,7 +193,7 @@ typedef struct { // ... // value of the entry to put // variadic to make things like (struct Val){1,1} work properly -#define mos_hm_put(hm, k, ...) (mos_hm_ini(hm), (hm)->key = k, (hm)->val = __VA_ARGS__, mos_hm_put_fn(&(hm), mos_hm_fn_args(hm), MOS_HM_LOAD_FACTOR)) +#define mos_hm_put(hm, k, ...) (mos_hm_ini(hm), (hm)->val = __VA_ARGS__, (hm)->key = k, mos_hm_put_fn(&(hm), mos_hm_fn_args(hm), MOS_HM_LOAD_FACTOR)) // Put a given entry in the hashmap // If entry of the same key exists - overwrites it @@ -293,7 +293,7 @@ extern void mos_hm_init(void *p_hm, size_t entry_size); extern void *mos_hm_new_fn(MosHmInitArgs args); extern void mos_hm_put_fn(void *p_hm, void *key, size_t entry_size, size_t key_size, uint8_t load_factor); extern size_t mos_hm_get_fn(void *hm, void *key, size_t entry_size, size_t key_size); -extern void *mos_hm_get_e_fn(const void *hm, const void *key, size_t entry_size, size_t key_size); +extern void *mos_hm_get_e_fn(void *hm, void *key, size_t entry_size, size_t key_size); extern int mos_hm_del_fn(void *hm, void *key, size_t entry_size, size_t key_size); extern void *mos_hm_first_fn(const void *hm, size_t entry_size); extern void *mos_hm_next_fn(const void *hm, const void *curr, size_t entry_size); |
