Changeset 0c48e14 in mainline


Ignore:
Timestamp:
2019-02-24T15:45:40Z (5 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
91bef446
Parents:
52b44c6
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-02 15:07:29)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-24 15:45:40)
Message:

Indicate and enforce constness of hash table key in certain functions

Location:
uspace
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/hbench/env.c

    r52b44c6 r0c48e14  
    5252}
    5353
    54 static size_t param_key_hash(void *key)
     54static size_t param_key_hash(const void *key)
    5555{
    56         char *key_str = key;
     56        const char *key_str = key;
    5757        return str_size(key_str);
    5858}
    5959
    60 static bool param_key_equal(void *key, const ht_link_t *item)
     60static bool param_key_equal(const void *key, const ht_link_t *item)
    6161{
    6262        param_t *param = hash_table_get_inst(item, param_t, link);
    63         char *key_str = key;
     63        const char *key_str = key;
    6464
    6565        return str_cmp(param->key, key_str) == 0;
  • uspace/app/trace/ipcp.c

    r52b44c6 r0c48e14  
    7272proto_t *proto_unknown;         /**< Protocol with no known methods. */
    7373
    74 static size_t pending_call_key_hash(void *key)
    75 {
    76         cap_call_handle_t *chandle = (cap_call_handle_t *) key;
     74static size_t pending_call_key_hash(const void *key)
     75{
     76        const cap_call_handle_t *chandle = key;
    7777        return cap_handle_raw(*chandle);
    7878}
     
    8484}
    8585
    86 static bool pending_call_key_equal(void *key, const ht_link_t *item)
    87 {
    88         cap_call_handle_t *chandle = (cap_call_handle_t *) key;
     86static bool pending_call_key_equal(const void *key, const ht_link_t *item)
     87{
     88        const cap_call_handle_t *chandle = key;
    8989        pending_call_t *hs = hash_table_get_inst(item, pending_call_t, link);
    9090
  • uspace/app/trace/proto.c

    r52b44c6 r0c48e14  
    5757/* Hash table operations. */
    5858
    59 static size_t srv_proto_key_hash(void *key)
    60 {
    61         return *(int *)key;
     59static size_t srv_proto_key_hash(const void *key)
     60{
     61        const int *n = key;
     62        return *n;
    6263}
    6364
     
    6869}
    6970
    70 static bool srv_proto_key_equal(void *key, const ht_link_t *item)
    71 {
     71static bool srv_proto_key_equal(const void *key, const ht_link_t *item)
     72{
     73        const int *n = key;
    7274        srv_proto_t *sp = hash_table_get_inst(item, srv_proto_t, link);
    73         return sp->srv == *(int *)key;
     75        return sp->srv == *n;
    7476}
    7577
     
    8284};
    8385
    84 static size_t method_oper_key_hash(void *key)
    85 {
    86         return *(int *)key;
     86static size_t method_oper_key_hash(const void *key)
     87{
     88        const int *n = key;
     89        return *n;
    8790}
    8891
     
    9396}
    9497
    95 static bool method_oper_key_equal(void *key, const ht_link_t *item)
    96 {
     98static bool method_oper_key_equal(const void *key, const ht_link_t *item)
     99{
     100        const int *n = key;
    97101        method_oper_t *mo = hash_table_get_inst(item, method_oper_t, link);
    98         return mo->method == *(int *)key;
     102        return mo->method == *n;
    99103}
    100104
  • uspace/lib/block/block.c

    r52b44c6 r0c48e14  
    241241}
    242242
    243 static size_t cache_key_hash(void *key)
    244 {
    245         aoff64_t *lba = (aoff64_t *)key;
     243static size_t cache_key_hash(const void *key)
     244{
     245        const aoff64_t *lba = key;
    246246        return *lba;
    247247}
     
    253253}
    254254
    255 static bool cache_key_equal(void *key, const ht_link_t *item)
    256 {
    257         aoff64_t *lba = (aoff64_t *)key;
     255static bool cache_key_equal(const void *key, const ht_link_t *item)
     256{
     257        const aoff64_t *lba = key;
    258258        block_t *b = hash_table_get_inst(item, block_t, hash_link);
    259259        return b->lba == *lba;
  • uspace/lib/c/generic/adt/hash_table.c

    r52b44c6 r0c48e14  
    245245 *
    246246 */
    247 ht_link_t *hash_table_find(const hash_table_t *h, void *key)
     247ht_link_t *hash_table_find(const hash_table_t *h, const void *key)
    248248{
    249249        assert(h && h->bucket);
     
    307307 * @return Returns the number of removed items.
    308308 */
    309 size_t hash_table_remove(hash_table_t *h, void *key)
     309size_t hash_table_remove(hash_table_t *h, const void *key)
    310310{
    311311        assert(h && h->bucket);
  • uspace/lib/c/generic/async/ports.c

    r52b44c6 r0c48e14  
    103103static hash_table_t interface_hash_table;
    104104
    105 static size_t interface_key_hash(void *key)
    106 {
    107         iface_t iface = *(iface_t *) key;
    108         return iface;
     105static size_t interface_key_hash(const void *key)
     106{
     107        const iface_t *iface = key;
     108        return *iface;
    109109}
    110110
     
    115115}
    116116
    117 static bool interface_key_equal(void *key, const ht_link_t *item)
    118 {
    119         iface_t iface = *(iface_t *) key;
     117static bool interface_key_equal(const void *key, const ht_link_t *item)
     118{
     119        const iface_t *iface = key;
    120120        interface_t *interface = hash_table_get_inst(item, interface_t, link);
    121         return iface == interface->iface;
     121        return *iface == interface->iface;
    122122}
    123123
     
    131131};
    132132
    133 static size_t port_key_hash(void *key)
    134 {
    135         port_id_t port_id = *(port_id_t *) key;
    136         return port_id;
     133static size_t port_key_hash(const void *key)
     134{
     135        const port_id_t *port_id = key;
     136        return *port_id;
    137137}
    138138
     
    143143}
    144144
    145 static bool port_key_equal(void *key, const ht_link_t *item)
    146 {
    147         port_id_t port_id = *(port_id_t *) key;
     145static bool port_key_equal(const void *key, const ht_link_t *item)
     146{
     147        const port_id_t *port_id = key;
    148148        port_t *port = hash_table_get_inst(item, port_t, link);
    149         return port_id == port->id;
     149        return *port_id == port->id;
    150150}
    151151
  • uspace/lib/c/generic/async/server.c

    r52b44c6 r0c48e14  
    231231static sysarg_t notification_avail = 0;
    232232
    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;
     233static size_t client_key_hash(const void *key)
     234{
     235        const task_id_t *in_task_id = key;
     236        return *in_task_id;
    237237}
    238238
     
    243243}
    244244
    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;
     245static bool client_key_equal(const void *key, const ht_link_t *item)
     246{
     247        const task_id_t *in_task_id = key;
    248248        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;
    250250}
    251251
     
    490490}
    491491
    492 static size_t notification_key_hash(void *key)
    493 {
    494         sysarg_t id = *(sysarg_t *) key;
    495         return id;
     492static size_t notification_key_hash(const void *key)
     493{
     494        const sysarg_t *id = key;
     495        return *id;
    496496}
    497497
     
    503503}
    504504
    505 static bool notification_key_equal(void *key, const ht_link_t *item)
    506 {
    507         sysarg_t id = *(sysarg_t *) key;
     505static bool notification_key_equal(const void *key, const ht_link_t *item)
     506{
     507        const sysarg_t *id = key;
    508508        notification_t *notification =
    509509            hash_table_get_inst(item, notification_t, htlink);
    510         return id == notification->imethod;
     510        return *id == notification->imethod;
    511511}
    512512
  • uspace/lib/c/include/adt/hash_table.h

    r52b44c6 r0c48e14  
    5353
    5454        /** Returns the hash of the key. */
    55         size_t (*key_hash)(void *key);
     55        size_t (*key_hash)(const void *key);
    5656
    5757        /** True if the items are equal (have the same lookup keys). */
     
    5959
    6060        /** Returns true if the key is equal to the item's lookup key. */
    61         bool (*key_equal)(void *key, const ht_link_t *item);
     61        bool (*key_equal)(const void *key, const ht_link_t *item);
    6262
    6363        /** Hash table item removal callback.
     
    9494extern void hash_table_insert(hash_table_t *, ht_link_t *);
    9595extern bool hash_table_insert_unique(hash_table_t *, ht_link_t *);
    96 extern ht_link_t *hash_table_find(const hash_table_t *, void *);
     96extern ht_link_t *hash_table_find(const hash_table_t *, const void *);
    9797extern ht_link_t *hash_table_find_next(const hash_table_t *, ht_link_t *,
    9898    ht_link_t *);
    99 extern size_t hash_table_remove(hash_table_t *, void *);
     99extern size_t hash_table_remove(hash_table_t *, const void *);
    100100extern void hash_table_remove_item(hash_table_t *, ht_link_t *);
    101101extern void hash_table_apply(hash_table_t *, bool (*)(ht_link_t *, void *),
  • uspace/lib/ext4/src/ops.c

    r52b44c6 r0c48e14  
    101101} node_key_t;
    102102
    103 static size_t open_nodes_key_hash(void *key_arg)
    104 {
    105         node_key_t *key = (node_key_t *)key_arg;
     103static size_t open_nodes_key_hash(const void *key_arg)
     104{
     105        const node_key_t *key = key_arg;
    106106        return hash_combine(key->service_id, key->index);
    107107}
     
    113113}
    114114
    115 static bool open_nodes_key_equal(void *key_arg, const ht_link_t *item)
    116 {
    117         node_key_t *key = (node_key_t *)key_arg;
     115static bool open_nodes_key_equal(const void *key_arg, const ht_link_t *item)
     116{
     117        const node_key_t *key = key_arg;
    118118        ext4_node_t *enode = hash_table_get_inst(item, ext4_node_t, link);
    119119
  • uspace/lib/nic/src/nic_addr_db.c

    r52b44c6 r0c48e14  
    6262} addr_key_t;
    6363
    64 static bool nic_addr_key_equal(void *key_arg, const ht_link_t *item)
    65 {
    66         addr_key_t *key = (addr_key_t *)key_arg;
     64static bool nic_addr_key_equal(const void *key_arg, const ht_link_t *item)
     65{
     66        const addr_key_t *key = key_arg;
    6767        nic_addr_entry_t *entry = member_to_inst(item, nic_addr_entry_t, link);
    6868
     
    8181}
    8282
    83 static size_t nic_addr_key_hash(void *k)
    84 {
    85         addr_key_t *key = (addr_key_t *)k;
     83static size_t nic_addr_key_hash(const void *k)
     84{
     85        const addr_key_t *key = k;
    8686        return addr_hash(key->len, key->addr);
    8787}
  • uspace/lib/nic/src/nic_wol_virtues.c

    r52b44c6 r0c48e14  
    4545 */
    4646
    47 static size_t nic_wv_key_hash(void *key)
    48 {
    49         return *(nic_wv_id_t *) key;
     47static size_t nic_wv_key_hash(const void *key)
     48{
     49        const nic_wv_id_t *k = key;
     50        return *k;
    5051}
    5152
     
    5657}
    5758
    58 static bool nic_wv_key_equal(void *key, const ht_link_t *item)
    59 {
    60         nic_wol_virtue_t *virtue = (nic_wol_virtue_t *) item;
    61         return (virtue->id == *(nic_wv_id_t *) key);
     59static bool nic_wv_key_equal(const void *key, const ht_link_t *item)
     60{
     61        const nic_wv_id_t *k = key;
     62        const nic_wol_virtue_t *virtue = (const nic_wol_virtue_t *) item;
     63        return (virtue->id == *k);
    6264}
    6365
  • uspace/srv/devman/devtree.c

    r52b44c6 r0c48e14  
    4242/* hash table operations */
    4343
    44 static inline size_t handle_key_hash(void *key)
    45 {
    46         devman_handle_t handle = *(devman_handle_t *)key;
    47         return handle;
     44static inline size_t handle_key_hash(const void *key)
     45{
     46        const devman_handle_t *handle = key;
     47        return *handle;
    4848}
    4949
     
    6060}
    6161
    62 static bool devman_devices_key_equal(void *key, const ht_link_t *item)
    63 {
    64         devman_handle_t handle = *(devman_handle_t *)key;
     62static bool devman_devices_key_equal(const void *key, const ht_link_t *item)
     63{
     64        const devman_handle_t *handle = key;
    6565        dev_node_t *dev = hash_table_get_inst(item, dev_node_t, devman_dev);
    66         return dev->handle == handle;
    67 }
    68 
    69 static bool devman_functions_key_equal(void *key, const ht_link_t *item)
    70 {
    71         devman_handle_t handle = *(devman_handle_t *)key;
     66        return dev->handle == *handle;
     67}
     68
     69static bool devman_functions_key_equal(const void *key, const ht_link_t *item)
     70{
     71        const devman_handle_t *handle = key;
    7272        fun_node_t *fun = hash_table_get_inst(item, fun_node_t, devman_fun);
    73         return fun->handle == handle;
    74 }
    75 
    76 static inline size_t service_id_key_hash(void *key)
    77 {
    78         service_id_t service_id = *(service_id_t *)key;
    79         return service_id;
     73        return fun->handle == *handle;
     74}
     75
     76static inline size_t service_id_key_hash(const void *key)
     77{
     78        const service_id_t *service_id = key;
     79        return *service_id;
    8080}
    8181
     
    8686}
    8787
    88 static bool loc_functions_key_equal(void *key, const ht_link_t *item)
    89 {
    90         service_id_t service_id = *(service_id_t *)key;
     88static bool loc_functions_key_equal(const void *key, const ht_link_t *item)
     89{
     90        const service_id_t *service_id = key;
    9191        fun_node_t *fun = hash_table_get_inst(item, fun_node_t, loc_fun);
    92         return fun->service_id == service_id;
     92        return fun->service_id == *service_id;
    9393}
    9494
  • uspace/srv/fs/cdfs/cdfs_ops.c

    r52b44c6 r0c48e14  
    285285} ht_key_t;
    286286
    287 static size_t nodes_key_hash(void *k)
    288 {
    289         ht_key_t *key = (ht_key_t *)k;
     287static size_t nodes_key_hash(const void *k)
     288{
     289        const ht_key_t *key = k;
    290290        return hash_combine(key->service_id, key->index);
    291291}
     
    297297}
    298298
    299 static bool nodes_key_equal(void *k, const ht_link_t *item)
     299static bool nodes_key_equal(const void *k, const ht_link_t *item)
    300300{
    301301        cdfs_node_t *node = hash_table_get_inst(item, cdfs_node_t, nh_link);
    302         ht_key_t *key = (ht_key_t *)k;
     302        const ht_key_t *key = k;
    303303
    304304        return key->service_id == node->fs->service_id && key->index == node->index;
  • uspace/srv/fs/exfat/exfat_idx.c

    r52b44c6 r0c48e14  
    117117} pos_key_t;
    118118
    119 static inline size_t pos_key_hash(void *key)
    120 {
    121         pos_key_t *pos = (pos_key_t *)key;
     119static inline size_t pos_key_hash(const void *key)
     120{
     121        const pos_key_t *pos = key;
    122122
    123123        size_t hash = 0;
     
    139139}
    140140
    141 static bool pos_key_equal(void *key, const ht_link_t *item)
    142 {
    143         pos_key_t *pos = (pos_key_t *)key;
     141static bool pos_key_equal(const void *key, const ht_link_t *item)
     142{
     143        const pos_key_t *pos = key;
    144144        exfat_idx_t *fidx = hash_table_get_inst(item, exfat_idx_t, uph_link);
    145145
     
    168168} idx_key_t;
    169169
    170 static size_t idx_key_hash(void *key_arg)
    171 {
    172         idx_key_t *key = (idx_key_t *)key_arg;
     170static size_t idx_key_hash(const void *key_arg)
     171{
     172        const idx_key_t *key = key_arg;
    173173        return hash_combine(key->service_id, key->index);
    174174}
     
    180180}
    181181
    182 static bool idx_key_equal(void *key_arg, const ht_link_t *item)
     182static bool idx_key_equal(const void *key_arg, const ht_link_t *item)
    183183{
    184184        exfat_idx_t *fidx = hash_table_get_inst(item, exfat_idx_t, uih_link);
    185         idx_key_t *key = (idx_key_t *)key_arg;
     185        const idx_key_t *key = key_arg;
    186186
    187187        return key->index == fidx->index && key->service_id == fidx->service_id;
  • uspace/srv/fs/fat/fat_idx.c

    r52b44c6 r0c48e14  
    117117} pos_key_t;
    118118
    119 static inline size_t pos_key_hash(void *key)
    120 {
    121         pos_key_t *pos = (pos_key_t *)key;
     119static inline size_t pos_key_hash(const void *key)
     120{
     121        const pos_key_t *pos = key;
    122122
    123123        size_t hash = 0;
     
    139139}
    140140
    141 static bool pos_key_equal(void *key, const ht_link_t *item)
    142 {
    143         pos_key_t *pos = (pos_key_t *)key;
     141static bool pos_key_equal(const void *key, const ht_link_t *item)
     142{
     143        const pos_key_t *pos = key;
    144144        fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uph_link);
    145145
     
    168168} idx_key_t;
    169169
    170 static size_t idx_key_hash(void *key_arg)
    171 {
    172         idx_key_t *key = (idx_key_t *)key_arg;
     170static size_t idx_key_hash(const void *key_arg)
     171{
     172        const idx_key_t *key = key_arg;
    173173        return hash_combine(key->service_id, key->index);
    174174}
     
    180180}
    181181
    182 static bool idx_key_equal(void *key_arg, const ht_link_t *item)
     182static bool idx_key_equal(const void *key_arg, const ht_link_t *item)
    183183{
    184184        fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uih_link);
    185         idx_key_t *key = (idx_key_t *)key_arg;
     185        const idx_key_t *key = key_arg;
    186186
    187187        return key->index == fidx->index && key->service_id == fidx->service_id;
  • uspace/srv/fs/locfs/locfs_ops.c

    r52b44c6 r0c48e14  
    7171/* Implementation of hash table interface for the nodes hash table. */
    7272
    73 static size_t services_key_hash(void *key)
    74 {
    75         return *(service_id_t *)key;
     73static size_t services_key_hash(const void *key)
     74{
     75        const service_id_t *k = key;
     76        return *k;
    7677}
    7778
     
    8283}
    8384
    84 static bool services_key_equal(void *key, const ht_link_t *item)
    85 {
     85static bool services_key_equal(const void *key, const ht_link_t *item)
     86{
     87        const service_id_t *k = key;
    8688        service_t *dev = hash_table_get_inst(item, service_t, link);
    87         return (dev->service_id == *(service_id_t *)key);
     89        return (dev->service_id == *k);
    8890}
    8991
  • uspace/srv/fs/mfs/mfs_ops.c

    r52b44c6 r0c48e14  
    100100
    101101static size_t
    102 open_nodes_key_hash(void *key)
    103 {
    104         node_key_t *node_key = (node_key_t *)key;
     102open_nodes_key_hash(const void *key)
     103{
     104        const node_key_t *node_key = key;
    105105        return hash_combine(node_key->service_id, node_key->index);
    106106}
     
    114114
    115115static bool
    116 open_nodes_key_equal(void *key, const ht_link_t *item)
    117 {
    118         node_key_t *node_key = (node_key_t *)key;
     116open_nodes_key_equal(const void *key, const ht_link_t *item)
     117{
     118        const node_key_t *node_key = key;
    119119        struct mfs_node *mnode = hash_table_get_inst(item, struct mfs_node, link);
    120120
  • uspace/srv/fs/tmpfs/tmpfs_ops.c

    r52b44c6 r0c48e14  
    147147} node_key_t;
    148148
    149 static size_t nodes_key_hash(void *k)
    150 {
    151         node_key_t *key = (node_key_t *)k;
     149static size_t nodes_key_hash(const void *k)
     150{
     151        const node_key_t *key = k;
    152152        return hash_combine(key->service_id, key->index);
    153153}
     
    159159}
    160160
    161 static bool nodes_key_equal(void *key_arg, const ht_link_t *item)
     161static bool nodes_key_equal(const void *key_arg, const ht_link_t *item)
    162162{
    163163        tmpfs_node_t *node = hash_table_get_inst(item, tmpfs_node_t, nh_link);
    164         node_key_t *key = (node_key_t *)key_arg;
     164        const node_key_t *key = key_arg;
    165165
    166166        return key->service_id == node->service_id && key->index == node->index;
  • uspace/srv/fs/udf/udf_idx.c

    r52b44c6 r0c48e14  
    6363}
    6464
    65 static size_t udf_idx_key_hash(void *k)
    66 {
    67         udf_ht_key_t *key = (udf_ht_key_t *) k;
     65static size_t udf_idx_key_hash(const void *k)
     66{
     67        const udf_ht_key_t *key = k;
    6868        return hash_combine(key->service_id, key->index);
    6969}
    7070
    71 static bool udf_idx_key_equal(void *k, const ht_link_t *item)
    72 {
    73         udf_ht_key_t *key = (udf_ht_key_t *) k;
     71static bool udf_idx_key_equal(const void *k, const ht_link_t *item)
     72{
     73        const udf_ht_key_t *key = k;
    7474        udf_node_t *node = hash_table_get_inst(item, udf_node_t, link);
    7575
  • uspace/srv/hid/input/gsp.c

    r52b44c6 r0c48e14  
    6464} trans_key_t;
    6565
    66 static size_t trans_key_hash(void *key)
    67 {
    68         trans_key_t *trans_key = (trans_key_t *)key;
     66static size_t trans_key_hash(const void *key)
     67{
     68        const trans_key_t *trans_key = key;
    6969        return hash_combine(trans_key->input, trans_key->old_state);
    7070}
     
    7676}
    7777
    78 static bool trans_key_equal(void *key, const ht_link_t *item)
    79 {
    80         trans_key_t *trans_key = (trans_key_t *)key;
     78static bool trans_key_equal(const void *key, const ht_link_t *item)
     79{
     80        const trans_key_t *trans_key = key;
    8181        gsp_trans_t *t = hash_table_get_inst(item, gsp_trans_t, link);
    8282
  • uspace/srv/ns/service.c

    r52b44c6 r0c48e14  
    6565} hashed_iface_t;
    6666
    67 static size_t service_key_hash(void *key)
    68 {
    69         return *(service_t *) key;
     67static size_t service_key_hash(const void *key)
     68{
     69        const service_t *srv = key;
     70        return *srv;
    7071}
    7172
     
    7879}
    7980
    80 static bool service_key_equal(void *key, const ht_link_t *item)
    81 {
     81static bool service_key_equal(const void *key, const ht_link_t *item)
     82{
     83        const service_t *srv = key;
    8284        hashed_service_t *service =
    8385            hash_table_get_inst(item, hashed_service_t, link);
    8486
    85         return service->service == *(service_t *) key;
    86 }
    87 
    88 static size_t iface_key_hash(void *key)
    89 {
    90         return *(iface_t *) key;
     87        return service->service == *srv;
     88}
     89
     90static size_t iface_key_hash(const void *key)
     91{
     92        const iface_t *iface = key;
     93        return *iface;
    9194}
    9295
     
    99102}
    100103
    101 static bool iface_key_equal(void *key, const ht_link_t *item)
    102 {
     104static bool iface_key_equal(const void *key, const ht_link_t *item)
     105{
     106        const iface_t *kiface = key;
    103107        hashed_iface_t *iface =
    104108            hash_table_get_inst(item, hashed_iface_t, link);
    105109
    106         return iface->iface == *(iface_t *) key;
     110        return iface->iface == *kiface;
    107111}
    108112
  • uspace/srv/ns/task.c

    r52b44c6 r0c48e14  
    5454} hashed_task_t;
    5555
    56 static size_t task_key_hash(void *key)
    57 {
    58         return *(task_id_t *)key;
    59 }
    60 
    61 static size_t task_hash(const ht_link_t  *item)
     56static size_t task_key_hash(const void *key)
     57{
     58        const task_id_t *tid = key;
     59        return *tid;
     60}
     61
     62static size_t task_hash(const ht_link_t *item)
    6263{
    6364        hashed_task_t *ht = hash_table_get_inst(item, hashed_task_t, link);
     
    6566}
    6667
    67 static bool task_key_equal(void *key, const ht_link_t *item)
    68 {
     68static bool task_key_equal(const void *key, const ht_link_t *item)
     69{
     70        const task_id_t *tid = key;
    6971        hashed_task_t *ht = hash_table_get_inst(item, hashed_task_t, link);
    70         return ht->id == *(task_id_t *)key;
     72        return ht->id == *tid;
    7173}
    7274
     
    9799/* label-to-id hash table operations */
    98100
    99 static size_t p2i_key_hash(void *key)
    100 {
    101         sysarg_t label = *(sysarg_t *)key;
    102         return label;
     101static size_t p2i_key_hash(const void *key)
     102{
     103        const sysarg_t *label = key;
     104        return *label;
    103105}
    104106
     
    109111}
    110112
    111 static bool p2i_key_equal(void *key, const ht_link_t *item)
    112 {
    113         sysarg_t label = *(sysarg_t *)key;
     113static bool p2i_key_equal(const void *key, const ht_link_t *item)
     114{
     115        const sysarg_t *label = key;
    114116        p2i_entry_t *entry = hash_table_get_inst(item, p2i_entry_t, link);
    115117
    116         return (label == entry->label);
     118        return (*label == entry->label);
    117119}
    118120
  • uspace/srv/vfs/vfs_node.c

    r52b44c6 r0c48e14  
    6060#define KEY_INDEX       2
    6161
    62 static size_t nodes_key_hash(void *);
     62static size_t nodes_key_hash(const void *);
    6363static size_t nodes_hash(const ht_link_t *);
    64 static bool nodes_key_equal(void *, const ht_link_t *);
     64static bool nodes_key_equal(const void *, const ht_link_t *);
    6565static vfs_triplet_t node_triplet(vfs_node_t *node);
    6666
     
    280280}
    281281
    282 static size_t nodes_key_hash(void *key)
    283 {
    284         vfs_triplet_t *tri = key;
     282static size_t nodes_key_hash(const void *key)
     283{
     284        const vfs_triplet_t *tri = key;
    285285        size_t hash = hash_combine(tri->fs_handle, tri->index);
    286286        return hash_combine(hash, tri->service_id);
     
    294294}
    295295
    296 static bool nodes_key_equal(void *key, const ht_link_t *item)
    297 {
    298         vfs_triplet_t *tri = key;
     296static bool nodes_key_equal(const void *key, const ht_link_t *item)
     297{
     298        const vfs_triplet_t *tri = key;
    299299        vfs_node_t *node = hash_table_get_inst(item, vfs_node_t, nh_link);
    300300        return node->fs_handle == tri->fs_handle &&
Note: See TracChangeset for help on using the changeset viewer.