Changeset 61eb2ce2 in mainline for kernel/generic/src/adt/hash_table.c
- Timestamp:
- 2023-02-05T22:03:19Z (2 years 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
-
kernel/generic/src/adt/hash_table.c
r07700ed r61eb2ce2 90 90 */ 91 91 bool hash_table_create(hash_table_t *h, size_t init_size, size_t max_load, 92 hash_table_ops_t *op)92 const hash_table_ops_t *op) 93 93 { 94 94 assert(h); … … 110 110 h->apply_ongoing = false; 111 111 112 if (h->op->remove_callback == NULL) {113 h->op->remove_callback = nop_remove_callback;114 }115 116 112 return true; 117 113 } … … 171 167 if (h->item_cnt == 0) 172 168 return; 169 170 void (*remove_cb)(ht_link_t *) = h->op->remove_callback ? h->op->remove_callback : nop_remove_callback; 173 171 174 172 for (size_t idx = 0; idx < h->bucket_cnt; ++idx) { … … 178 176 179 177 list_remove(cur); 180 h->op->remove_callback(cur_link);178 remove_cb(cur_link); 181 179 } 182 180 } … … 321 319 ++removed; 322 320 list_remove(cur); 323 h->op->remove_callback(cur_link); 321 322 if (h->op->remove_callback) 323 h->op->remove_callback(cur_link); 324 324 } 325 325 } … … 340 340 list_remove(&item->link); 341 341 --h->item_cnt; 342 h->op->remove_callback(item); 342 343 if (h->op->remove_callback) 344 h->op->remove_callback(item); 343 345 shrink_if_needed(h); 344 346 }
Note:
See TracChangeset
for help on using the changeset viewer.