src/cx/hash_map.h

changeset 1675
36c0fb2b60b2
parent 1605
55b13f583356
equal deleted inserted replaced
1674:8b0f162ac88e 1675:36c0fb2b60b2
35 35
36 #ifndef UCX_HASH_MAP_H 36 #ifndef UCX_HASH_MAP_H
37 #define UCX_HASH_MAP_H 37 #define UCX_HASH_MAP_H
38 38
39 #include "map.h" 39 #include "map.h"
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 40
45 /** Internal structure for an element of a hash map. */ 41 /** Internal structure for an element of a hash map. */
46 struct cx_hash_map_element_s; 42 struct cx_hash_map_element_s;
47 43
48 /** 44 /**
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

mercurial