ucx/map.h

changeset 169
08adb4f87160
parent 167
cecfbb5f8618
child 255
bf19378aed58
equal deleted inserted replaced
168:6db9c5d7d7ff 169:08adb4f87160
144 UcxMap *ucx_map_new_a(UcxAllocator *allocator, size_t size); 144 UcxMap *ucx_map_new_a(UcxAllocator *allocator, size_t size);
145 145
146 /** 146 /**
147 * Frees a hash map. 147 * Frees a hash map.
148 * 148 *
149 * <b>Note:</b> the contents are <b>not</b> freed, use an UcxMempool for that 149 * <b>Note:</b> the contents are <b>not</b> freed, use ucx_map_free_content()
150 * purpose. 150 * before calling this function to achieve that.
151 * 151 *
152 * @param map the map to be freed 152 * @param map the map to be freed
153 * @see ucx_map_free_content()
153 */ 154 */
154 void ucx_map_free(UcxMap *map); 155 void ucx_map_free(UcxMap *map);
155 156
156 /** 157 /**
158 * Frees the contents of a hash map.
159 *
160 * This is a convenience function that iterates over the map and passes all
161 * values to the specified destructor function (e.g. stdlib free()).
162 *
163 * You must ensure, that it is valid to pass each value in the map to the same
164 * destructor function.
165 *
166 * You should free or clear the map afterwards, as the contents will be invalid.
167 *
168 * @param map for which the contents shall be freed
169 * @param destr pointer to the destructor function
170 * @see ucx_map_free()
171 * @see ucx_map_clear()
172 */
173 void ucx_map_free_content(UcxMap *map, ucx_destructor destr);
174
175 /**
157 * Clears a hash map. 176 * Clears a hash map.
158 * 177 *
159 * <b>Note:</b> the contents are <b>not</b> freed. 178 * <b>Note:</b> the contents are <b>not</b> freed, use ucx_map_free_content()
160 * 179 * before calling this function to achieve that.
161 * @param map the map to be freed 180 *
181 * @param map the map to be cleared
182 * @see ucx_map_free_content()
162 */ 183 */
163 void ucx_map_clear(UcxMap *map); 184 void ucx_map_clear(UcxMap *map);
185
164 186
165 /** 187 /**
166 * Copies contents from a map to another map using a copy function. 188 * Copies contents from a map to another map using a copy function.
167 * 189 *
168 * <b>Note:</b> The destination map does not need to be empty. However, if it 190 * <b>Note:</b> The destination map does not need to be empty. However, if it

mercurial