Ignore:
File:
1 edited

Legend:

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

    r55b77d9 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);
     
    148150       
    149151        if (keys == h->max_keys) {
    150                 link_t *cur;
    151152       
    152153                /*
     
    168169         */
    169170        for (chain = 0; chain < h->entries; chain++) {
    170                 list_foreach(h->entry[chain], cur) {
     171                for (cur = h->entry[chain].next; cur != &h->entry[chain]; cur = cur->next) {
    171172                        if (h->op->compare(key, keys, cur)) {
    172173                                link_t *hlp;
Note: See TracChangeset for help on using the changeset viewer.