diff options
| author | Fabrice <fabrice@schaub-dev.xyz> | 2026-03-20 19:00:37 +0100 |
|---|---|---|
| committer | Fabrice <fabrice@schaub-dev.xyz> | 2026-03-20 19:00:37 +0100 |
| commit | e3a119b910a3735de914e686fd4643c0064654bc (patch) | |
| tree | 1adc139000f14cc503f76164784aed024066d77e | |
| parent | 209cb97557aa6fae5c9e8d062f590e7e11a420cc (diff) | |
move to impl
| -rw-r--r-- | cheesemap.c | 18 | ||||
| -rw-r--r-- | cheesemap.h | 16 |
2 files changed, 20 insertions, 14 deletions
diff --git a/cheesemap.c b/cheesemap.c index c443593..5e6c124 100644 --- a/cheesemap.c +++ b/cheesemap.c @@ -23,3 +23,21 @@ void cm_raw_drop(struct cheesemap_raw* map, uintptr_t entry_size, uint8_t* origin = cm_raw_origin(map, entry_size); fns->free(origin, fns->mem_usr); } + +void cm_new(struct cheesemap* map, uintptr_t entry_size, + uint8_t* mem_usr, cm_malloc_fn malloc, cm_free_fn free, + uint8_t* map_usr, cm_hash_fn hash, + cm_compare_fn compare) { + assert(map != NULL); + assert(malloc != NULL && free != NULL); + assert(hash != NULL && compare != NULL); + + struct cheesemap_fns fns = { + mem_usr, map_usr, // + malloc, free, // + hash, compare, // + }; + + *map = (struct cheesemap){entry_size, fns, cm_raw_new()}; +} + diff --git a/cheesemap.h b/cheesemap.h index 9d7139d..d49bfce 100644 --- a/cheesemap.h +++ b/cheesemap.h @@ -94,22 +94,10 @@ struct cheesemap { struct cheesemap_raw raw; }; -static inline void cm_new(struct cheesemap* map, uintptr_t entry_size, +void cm_new(struct cheesemap* map, uintptr_t entry_size, uint8_t* mem_usr, cm_malloc_fn malloc, cm_free_fn free, uint8_t* map_usr, cm_hash_fn hash, - cm_compare_fn compare) { - assert(map != NULL); - assert(malloc != NULL && free != NULL); - assert(hash != NULL && compare != NULL); - - struct cheesemap_fns fns = { - mem_usr, map_usr, // - malloc, free, // - hash, compare, // - }; - - *map = (struct cheesemap){entry_size, fns, cm_raw_new()}; -} + cm_compare_fn compare); static inline void cm_drop(struct cheesemap* map) { assert(map != NULL); |
