Changeset 963037b0 in mainline


Ignore:
Timestamp:
2018-03-14T18:25:33Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
30f1a25
Parents:
948222e4
Message:

Do not consider the bucket head as a table element

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/adt/hash_table.c

    r948222e4 r963037b0  
    274274        assert(h && h->bucket);
    275275
     276        size_t idx = h->op->hash(item) % h->bucket_cnt;
     277
    276278        /* Traverse the circular list until we reach the starting item again. */
    277279        for (link_t *cur = item->link.next; cur != &item->link; cur = cur->next) {
    278280                assert(cur);
     281
     282                if (cur == &h->bucket[idx].head)
     283                        continue;
     284
    279285                ht_link_t *cur_link = member_to_inst(cur, ht_link_t, link);
    280286                /*
  • uspace/lib/c/generic/adt/hash_table.c

    r948222e4 r963037b0  
    274274        assert(h && h->bucket);
    275275
     276        size_t idx = h->op->hash(item) % h->bucket_cnt;
     277
    276278        /* Traverse the circular list until we reach the starting item again. */
    277279        for (link_t *cur = item->link.next; cur != &item->link; cur = cur->next) {
    278280                assert(cur);
     281
     282                if (cur == &h->bucket[idx].head)
     283                        continue;
     284
    279285                ht_link_t *cur_link = member_to_inst(cur, ht_link_t, link);
    280286                /*
Note: See TracChangeset for help on using the changeset viewer.