Changeset 61eb2ce2 in mainline for uspace/lib/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)
- Location:
- uspace/lib/c
- Files:
-
- 4 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 } -
uspace/lib/c/generic/async/ports.c
r07700ed r61eb2ce2 123 123 124 124 /** Operations for the port hash table. */ 125 static hash_table_ops_t interface_hash_table_ops = {125 static const hash_table_ops_t interface_hash_table_ops = { 126 126 .hash = interface_hash, 127 127 .key_hash = interface_key_hash, … … 151 151 152 152 /** Operations for the port hash table. */ 153 static hash_table_ops_t port_hash_table_ops = {153 static const hash_table_ops_t port_hash_table_ops = { 154 154 .hash = port_hash, 155 155 .key_hash = port_key_hash, -
uspace/lib/c/generic/async/server.c
r07700ed r61eb2ce2 250 250 251 251 /** Operations for the client hash table. */ 252 static hash_table_ops_t client_hash_table_ops = {252 static const hash_table_ops_t client_hash_table_ops = { 253 253 .hash = client_hash, 254 254 .key_hash = client_key_hash, … … 511 511 512 512 /** Operations for the notification hash table. */ 513 static hash_table_ops_t notification_hash_table_ops = {513 static const hash_table_ops_t notification_hash_table_ops = { 514 514 .hash = notification_hash, 515 515 .key_hash = notification_key_hash, -
uspace/lib/c/include/adt/hash_table.h
r07700ed r61eb2ce2 73 73 /** Hash table structure. */ 74 74 typedef struct { 75 hash_table_ops_t *op;75 const hash_table_ops_t *op; 76 76 list_t *bucket; 77 77 size_t bucket_cnt; … … 86 86 87 87 extern bool hash_table_create(hash_table_t *, size_t, size_t, 88 hash_table_ops_t *);88 const hash_table_ops_t *); 89 89 extern void hash_table_destroy(hash_table_t *); 90 90
Note:
See TracChangeset
for help on using the changeset viewer.