| 81 * (if @c NULL, the cxDefaultAllocator will be used) |
77 * (if @c NULL, the cxDefaultAllocator will be used) |
| 82 * @param itemsize the size of one element |
78 * @param itemsize the size of one element |
| 83 * @param buckets the initial number of buckets in this hash map |
79 * @param buckets the initial number of buckets in this hash map |
| 84 * @return a pointer to the new hash map |
80 * @return a pointer to the new hash map |
| 85 */ |
81 */ |
| 86 cx_attr_nodiscard cx_attr_malloc cx_attr_dealloc(cxMapFree, 1) |
82 CX_EXTERN CX_NODISCARD CX_MALLOC CX_DEALLOC(cxMapFree, 1) |
| 87 CX_EXPORT CxMap *cxHashMapCreate(const CxAllocator *allocator, |
83 CxMap *cxHashMapCreate(const CxAllocator *allocator, |
| 88 size_t itemsize, size_t buckets); |
84 size_t itemsize, size_t buckets); |
| 89 |
85 |
| 90 /** |
86 /** |
| 91 * Increases the number of buckets, if necessary. |
87 * Increases the number of buckets, if necessary. |
| 92 * |
88 * |
| 104 * |
100 * |
| 105 * @param map the map to rehash |
101 * @param map the map to rehash |
| 106 * @retval zero success |
102 * @retval zero success |
| 107 * @retval non-zero if a memory allocation error occurred |
103 * @retval non-zero if a memory allocation error occurred |
| 108 */ |
104 */ |
| 109 cx_attr_nonnull |
105 CX_EXTERN CX_NONNULL |
| 110 CX_EXPORT int cxMapRehash(CxMap *map); |
106 int cxMapRehash(CxMap *map); |
| 111 |
|
| 112 |
|
| 113 #ifdef __cplusplus |
|
| 114 } // extern "C" |
|
| 115 #endif |
|
| 116 |
107 |
| 117 #endif // UCX_HASH_MAP_H |
108 #endif // UCX_HASH_MAP_H |