Changeset 0c48e14 in mainline for uspace/lib/c/generic/async/server.c


Ignore:
Timestamp:
2019-02-24T15:45:40Z (6 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.