Changeset 5e801dc in mainline for uspace/lib/c/generic
- Timestamp:
- 2019-02-25T14:42:38Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a4e78743
- Parents:
- ee8d4d6
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-25 14:42:38)
- git-committer:
- GitHub <noreply@…> (2019-02-25 14:42:38)
- Location:
- uspace/lib/c/generic
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/adt/hash_table.c
ree8d4d6 r5e801dc 245 245 * 246 246 */ 247 ht_link_t *hash_table_find(const hash_table_t *h, void *key)247 ht_link_t *hash_table_find(const hash_table_t *h, const void *key) 248 248 { 249 249 assert(h && h->bucket); … … 303 303 * @param key Array of keys that will be compared against items of 304 304 * the hash table. 305 * @param keys Number of keys in the 'key' array.306 305 * 307 306 * @return Returns the number of removed items. 308 307 */ 309 size_t hash_table_remove(hash_table_t *h, void *key)308 size_t hash_table_remove(hash_table_t *h, const void *key) 310 309 { 311 310 assert(h && h->bucket); -
uspace/lib/c/generic/async/ports.c
ree8d4d6 r5e801dc 103 103 static hash_table_t interface_hash_table; 104 104 105 static size_t interface_key_hash( void *key)106 { 107 iface_t iface = *(iface_t *)key;108 return iface;105 static size_t interface_key_hash(const void *key) 106 { 107 const iface_t *iface = key; 108 return *iface; 109 109 } 110 110 … … 115 115 } 116 116 117 static bool interface_key_equal( void *key, const ht_link_t *item)118 { 119 iface_t iface = *(iface_t *)key;117 static bool interface_key_equal(const void *key, const ht_link_t *item) 118 { 119 const iface_t *iface = key; 120 120 interface_t *interface = hash_table_get_inst(item, interface_t, link); 121 return iface == interface->iface;121 return *iface == interface->iface; 122 122 } 123 123 … … 131 131 }; 132 132 133 static size_t port_key_hash( void *key)134 { 135 port_id_t port_id = *(port_id_t *)key;136 return port_id;133 static size_t port_key_hash(const void *key) 134 { 135 const port_id_t *port_id = key; 136 return *port_id; 137 137 } 138 138 … … 143 143 } 144 144 145 static bool port_key_equal( void *key, const ht_link_t *item)146 { 147 port_id_t port_id = *(port_id_t *)key;145 static bool port_key_equal(const void *key, const ht_link_t *item) 146 { 147 const port_id_t *port_id = key; 148 148 port_t *port = hash_table_get_inst(item, port_t, link); 149 return port_id == port->id;149 return *port_id == port->id; 150 150 } 151 151 -
uspace/lib/c/generic/async/server.c
ree8d4d6 r5e801dc 231 231 static sysarg_t notification_avail = 0; 232 232 233 static size_t client_key_hash( void *key)234 { 235 task_id_t in_task_id = *(task_id_t *)key;236 return in_task_id;233 static size_t client_key_hash(const void *key) 234 { 235 const task_id_t *in_task_id = key; 236 return *in_task_id; 237 237 } 238 238 … … 243 243 } 244 244 245 static bool client_key_equal( void *key, const ht_link_t *item)246 { 247 task_id_t in_task_id = *(task_id_t *)key;245 static bool client_key_equal(const void *key, const ht_link_t *item) 246 { 247 const task_id_t *in_task_id = key; 248 248 client_t *client = hash_table_get_inst(item, client_t, link); 249 return in_task_id == client->in_task_id;249 return *in_task_id == client->in_task_id; 250 250 } 251 251 … … 490 490 } 491 491 492 static size_t notification_key_hash( void *key)493 { 494 sysarg_t id = *(sysarg_t *)key;495 return id;492 static size_t notification_key_hash(const void *key) 493 { 494 const sysarg_t *id = key; 495 return *id; 496 496 } 497 497 … … 503 503 } 504 504 505 static bool notification_key_equal( void *key, const ht_link_t *item)506 { 507 sysarg_t id = *(sysarg_t *)key;505 static bool notification_key_equal(const void *key, const ht_link_t *item) 506 { 507 const sysarg_t *id = key; 508 508 notification_t *notification = 509 509 hash_table_get_inst(item, notification_t, htlink); 510 return id == notification->imethod;510 return *id == notification->imethod; 511 511 } 512 512
Note:
See TracChangeset
for help on using the changeset viewer.