Changeset 61eb2ce2 in mainline for uspace/lib/c/generic/adt/hash_table.c
- Timestamp:
- 2023-02-05T22:03:19Z (15 months ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b596d0d
- Parents:
- 07700ed
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-05 22:01:46)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-05 22:03:19)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/adt/hash_table.c
r07700ed r61eb2ce2 91 91 */ 92 92 bool hash_table_create(hash_table_t *h, size_t init_size, size_t max_load, 93 hash_table_ops_t *op)93 const hash_table_ops_t *op) 94 94 { 95 95 assert(h); … … 111 111 h->apply_ongoing = false; 112 112 113 if (h->op->remove_callback == NULL) {114 h->op->remove_callback = nop_remove_callback;115 }116 117 113 return true; 118 114 } … … 172 168 if (h->item_cnt == 0) 173 169 return; 170 171 void (*remove_cb)(ht_link_t *) = h->op->remove_callback ? h->op->remove_callback : nop_remove_callback; 174 172 175 173 for (size_t idx = 0; idx < h->bucket_cnt; ++idx) { … … 179 177 180 178 list_remove(cur); 181 h->op->remove_callback(cur_link);179 remove_cb(cur_link); 182 180 } 183 181 } … … 322 320 ++removed; 323 321 list_remove(cur); 324 h->op->remove_callback(cur_link); 322 323 if (h->op->remove_callback) 324 h->op->remove_callback(cur_link); 325 325 } 326 326 } … … 341 341 list_remove(&item->link); 342 342 --h->item_cnt; 343 h->op->remove_callback(item); 343 344 if (h->op->remove_callback) 345 h->op->remove_callback(item); 344 346 shrink_if_needed(h); 345 347 }
Note:
See TracChangeset
for help on using the changeset viewer.