Ignore:
File:
1 edited

Legend:

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

    rb72efe8 r96b02eb9  
    6262        ASSERT(max_keys > 0);
    6363       
    64         h->entry = (list_t *) malloc(m * sizeof(list_t), 0);
     64        h->entry = (link_t *) malloc(m * sizeof(link_t), 0);
    6565        if (!h->entry)
    6666                panic("Cannot allocate memory for hash table.");
    6767       
    68         memsetb(h->entry, m * sizeof(list_t), 0);
     68        memsetb(h->entry, m * sizeof(link_t), 0);
    6969       
    7070        for (i = 0; i < m; i++)
     
    107107link_t *hash_table_find(hash_table_t *h, sysarg_t key[])
    108108{
     109        link_t *cur;
    109110        size_t chain;
    110111       
     
    117118        ASSERT(chain < h->entries);
    118119       
    119         list_foreach(h->entry[chain], cur) {
     120        for (cur = h->entry[chain].next; cur != &h->entry[chain]; cur = cur->next) {
    120121                if (h->op->compare(key, h->max_keys, cur)) {
    121122                        /*
     
    140141{
    141142        size_t chain;
     143        link_t *cur;
    142144       
    143145        ASSERT(h);
     
    147149        ASSERT(keys <= h->max_keys);
    148150       
     151        if (keys == h->max_keys) {
    149152       
    150         if (keys == h->max_keys) {
    151                 link_t *cur;
    152                
    153153                /*
    154154                 * All keys are known, hash_table_find() can be used to find the entry.
     
    169169         */
    170170        for (chain = 0; chain < h->entries; chain++) {
    171                 link_t *cur;
    172                 for (cur = h->entry[chain].head.next; cur != &h->entry[chain].head;
    173                     cur = cur->next) {
     171                for (cur = h->entry[chain].next; cur != &h->entry[chain]; cur = cur->next) {
    174172                        if (h->op->compare(key, keys, cur)) {
    175173                                link_t *hlp;
Note: See TracChangeset for help on using the changeset viewer.