66 GHashFunc hash_func, GEqualFunc eql_func)
89 GHashFunc hash_func, GEqualFunc eql_func)
WS_DLL_PUBLIC wmem_map_t * wmem_map_new(wmem_allocator_t *allocator, GHashFunc hash_func, GEqualFunc eql_func) G_GNUC_MALLOC
Creates a map with the given allocator scope.
Definition wmem_map.c:139
WS_DLL_PUBLIC unsigned wmem_int64_hash(const void *key)
Secure hash function for 64-bit integer keys using wmem_strong_hash.
Definition wmem_map.c:669
WS_DLL_PUBLIC void * wmem_map_remove(wmem_map_t *map, const void *key)
Remove a value from the map. If no value is stored at that key, nothing happens.
Definition wmem_map.c:424
WS_DLL_PUBLIC unsigned wmem_map_size(const wmem_map_t *map)
Return the number of elements in the map.
Definition wmem_map.c:584
WS_DLL_PUBLIC void wmem_map_foreach(const wmem_map_t *map, GHFunc foreach_func, void *user_data)
Run a function against all key/value pairs in the map.
Definition wmem_map.c:511
WS_DLL_PUBLIC void * wmem_map_find(const wmem_map_t *map, GHRFunc foreach_func, void *user_data)
Run a function against all key/value pairs in the map until the function returns true,...
Definition wmem_map.c:531
WS_DLL_PUBLIC unsigned wmem_map_foreach_remove(wmem_map_t *map, GHRFunc foreach_func, void *user_data)
Run a function against all key/value pairs in the map. If the function returns true,...
Definition wmem_map.c:555
WS_DLL_PUBLIC unsigned wmem_double_hash(const void *key)
Secure hash function for double-precision floating-point keys using wmem_strong_hash.
Definition wmem_map.c:675
WS_DLL_PUBLIC wmem_list_t * wmem_map_get_keys(wmem_allocator_t *list_allocator, const wmem_map_t *map)
Retrieves a list of keys inside the map.
Definition wmem_map.c:488
WS_DLL_PUBLIC unsigned wmem_str_hash(const void *key)
Secure hash function for string keys using wmem_strong_hash.
Definition wmem_map.c:658
WS_DLL_PUBLIC uint32_t wmem_strong_hash(const uint8_t *buf, const size_t len)
Compute a strong hash value for an arbitrary sequence of bytes.
Definition wmem_map.c:618
WS_DLL_PUBLIC bool wmem_map_steal(wmem_map_t *map, const void *key)
Remove a key and value from the map but does not destroy (free) them. If no value is stored at that k...
Definition wmem_map.c:457
WS_DLL_PUBLIC bool wmem_map_contains(const wmem_map_t *map, const void *key)
Check if a value is in the map.
Definition wmem_map.c:343
WS_DLL_PUBLIC void * wmem_map_insert(wmem_map_t *map, const void *key, void *value)
Inserts a value into the map.
Definition wmem_map.c:293
WS_DLL_PUBLIC bool wmem_map_lookup_extended(const wmem_map_t *map, const void *key, const void **orig_key, void **value)
Lookup a value in the map, returning the key, value, and a boolean which is true if the key is found.
Definition wmem_map.c:393
WS_DLL_PUBLIC size_t wmem_map_reserve(wmem_map_t *map, uint64_t capacity)
Ensure that a certain number of elements can be stored in the wmem_map without having to grow the int...
Definition wmem_map.c:590
WS_DLL_PUBLIC void * wmem_map_lookup(const wmem_map_t *map, const void *key)
Lookup a value in the map.
Definition wmem_map.c:368
WS_DLL_PUBLIC wmem_map_t * wmem_map_new_autoreset(wmem_allocator_t *metadata_scope, wmem_allocator_t *data_scope, GHashFunc hash_func, GEqualFunc eql_func) G_GNUC_MALLOC
Creates a map with two allocator scopes.
Definition wmem_map.c:188
WS_DLL_PUBLIC void wmem_map_destroy(wmem_map_t *map, bool free_keys, bool free_values)
Cleanup memory used by the map instead of waiting for the allocator pool to be freed or destroyed.
Definition wmem_map.c:267
Definition wmem_allocator.h:27
Definition wmem_list.c:23