ucx/cx/hash_map.h

changeset 11
0aa8cbd7912e
parent 0
1a157da63d7c
child 16
04c9f8d8f03b
equal deleted inserted replaced
10:80f9d007cb52 11:0aa8cbd7912e
75 * @note Iterators provided by this hash map implementation provide the remove operation. 75 * @note Iterators provided by this hash map implementation provide the remove operation.
76 * The index value of an iterator is incremented when the iterator advanced without removal. 76 * The index value of an iterator is incremented when the iterator advanced without removal.
77 * In other words, when the iterator is finished, \c index==size . 77 * In other words, when the iterator is finished, \c index==size .
78 * 78 *
79 * @param allocator the allocator to use 79 * @param allocator the allocator to use
80 * (if \c NULL, a default stdlib allocator will be used)
80 * @param itemsize the size of one element 81 * @param itemsize the size of one element
81 * @param buckets the initial number of buckets in this hash map 82 * @param buckets the initial number of buckets in this hash map
82 * @return a pointer to the new hash map 83 * @return a pointer to the new hash map
83 */ 84 */
84 __attribute__((__nonnull__, __warn_unused_result__)) 85 cx_attr_nodiscard
86 cx_attr_malloc
87 cx_attr_dealloc(cxMapFree, 1)
85 CxMap *cxHashMapCreate( 88 CxMap *cxHashMapCreate(
86 CxAllocator const *allocator, 89 const CxAllocator *allocator,
87 size_t itemsize, 90 size_t itemsize,
88 size_t buckets 91 size_t buckets
89 ); 92 );
90 93
91 /** 94 /**
120 * @note If the specified map is not a hash map, the behavior is undefined. 123 * @note If the specified map is not a hash map, the behavior is undefined.
121 * 124 *
122 * @param map the map to rehash 125 * @param map the map to rehash
123 * @return zero on success, non-zero if a memory allocation error occurred 126 * @return zero on success, non-zero if a memory allocation error occurred
124 */ 127 */
125 __attribute__((__nonnull__)) 128 cx_attr_nonnull
126 int cxMapRehash(CxMap *map); 129 int cxMapRehash(CxMap *map);
127 130
128 131
129 #ifdef __cplusplus 132 #ifdef __cplusplus
130 } // extern "C" 133 } // extern "C"

mercurial