src/cx/hash_map.h

changeset 1426
3a89b31f0724
parent 1424
563033aa998c
equal deleted inserted replaced
1425:83284b289430 1426:3a89b31f0724
81 * (if @c NULL, the cxDefaultAllocator will be used) 81 * (if @c NULL, the cxDefaultAllocator will be used)
82 * @param itemsize the size of one element 82 * @param itemsize the size of one element
83 * @param buckets the initial number of buckets in this hash map 83 * @param buckets the initial number of buckets in this hash map
84 * @return a pointer to the new hash map 84 * @return a pointer to the new hash map
85 */ 85 */
86 cx_attr_nodiscard 86 cx_attr_nodiscard cx_attr_malloc cx_attr_dealloc(cxMapFree, 1)
87 cx_attr_malloc 87 CX_EXPORT CxMap *cxHashMapCreate(const CxAllocator *allocator,
88 cx_attr_dealloc(cxMapFree, 1) 88 size_t itemsize, size_t buckets);
89 cx_attr_export
90 CxMap *cxHashMapCreate(
91 const CxAllocator *allocator,
92 size_t itemsize,
93 size_t buckets
94 );
95 89
96 /** 90 /**
97 * Creates a new hash map with a default number of buckets. 91 * Creates a new hash map with a default number of buckets.
98 * 92 *
99 * If @p elem_size is #CX_STORE_POINTERS, the created map stores pointers instead of 93 * If @p elem_size is #CX_STORE_POINTERS, the created map stores pointers instead of
127 * @param map the map to rehash 121 * @param map the map to rehash
128 * @retval zero success 122 * @retval zero success
129 * @retval non-zero if a memory allocation error occurred 123 * @retval non-zero if a memory allocation error occurred
130 */ 124 */
131 cx_attr_nonnull 125 cx_attr_nonnull
132 cx_attr_export 126 CX_EXPORT int cxMapRehash(CxMap *map);
133 int cxMapRehash(CxMap *map);
134 127
135 128
136 #ifdef __cplusplus 129 #ifdef __cplusplus
137 } // extern "C" 130 } // extern "C"
138 #endif 131 #endif

mercurial