Ignore:
Timestamp:
2019-02-01T22:32:38Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
00b7fc8
Parents:
1a37496
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-01 21:22:39)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-01 22:32:38)
Message:

Avoid directly using .head/.next/.prev of list_t/link_t

Use existing constructs from <adt/list.h> instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/adt/hash_table.c

    r1a37496 rf959a20f  
    273273
    274274        size_t idx = h->op->hash(item) % h->bucket_cnt;
     275        list_t *list = &h->bucket[idx];
    275276
    276277        /* Traverse the circular list until we reach the starting item again. */
    277         for (link_t *cur = item->link.next; cur != &first->link;
    278             cur = cur->next) {
    279                 assert(cur);
    280 
    281                 if (cur == &h->bucket[idx].head)
    282                         continue;
     278        for (link_t *cur = list_next(&item->link, list); cur != &first->link;
     279            cur = list_next(cur, list)) {
     280
     281                if (!cur)
     282                        cur = list_first(list);
    283283
    284284                ht_link_t *cur_link = member_to_inst(cur, ht_link_t, link);
Note: See TracChangeset for help on using the changeset viewer.