src/map.c

changeset 277
f819fe5e20f5
parent 259
2f5dea574a75
child 287
98da78a1e69a
equal deleted inserted replaced
274:0923c036b913 277:f819fe5e20f5
84 84
85 void ucx_map_free_content(UcxMap *map, ucx_destructor destr) { 85 void ucx_map_free_content(UcxMap *map, ucx_destructor destr) {
86 UcxMapIterator iter = ucx_map_iterator(map); 86 UcxMapIterator iter = ucx_map_iterator(map);
87 void *val; 87 void *val;
88 UCX_MAP_FOREACH(key, val, iter) { 88 UCX_MAP_FOREACH(key, val, iter) {
89 destr(val); 89 if (destr) {
90 destr(val);
91 } else {
92 map->allocator->free(val, NULL);
93 }
90 } 94 }
91 } 95 }
92 96
93 void ucx_map_clear(UcxMap *map) { 97 void ucx_map_clear(UcxMap *map) {
94 if (map->count == 0) { 98 if (map->count == 0) {

mercurial