Changes in kernel/generic/src/adt/hash_table.c [b72efe8:96b02eb9] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/adt/hash_table.c
rb72efe8 r96b02eb9 62 62 ASSERT(max_keys > 0); 63 63 64 h->entry = (li st_t *) malloc(m * sizeof(list_t), 0);64 h->entry = (link_t *) malloc(m * sizeof(link_t), 0); 65 65 if (!h->entry) 66 66 panic("Cannot allocate memory for hash table."); 67 67 68 memsetb(h->entry, m * sizeof(li st_t), 0);68 memsetb(h->entry, m * sizeof(link_t), 0); 69 69 70 70 for (i = 0; i < m; i++) … … 107 107 link_t *hash_table_find(hash_table_t *h, sysarg_t key[]) 108 108 { 109 link_t *cur; 109 110 size_t chain; 110 111 … … 117 118 ASSERT(chain < h->entries); 118 119 119 list_foreach(h->entry[chain], cur) {120 for (cur = h->entry[chain].next; cur != &h->entry[chain]; cur = cur->next) { 120 121 if (h->op->compare(key, h->max_keys, cur)) { 121 122 /* … … 140 141 { 141 142 size_t chain; 143 link_t *cur; 142 144 143 145 ASSERT(h); … … 147 149 ASSERT(keys <= h->max_keys); 148 150 151 if (keys == h->max_keys) { 149 152 150 if (keys == h->max_keys) {151 link_t *cur;152 153 153 /* 154 154 * All keys are known, hash_table_find() can be used to find the entry. … … 169 169 */ 170 170 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) { 174 172 if (h->op->compare(key, keys, cur)) { 175 173 link_t *hlp;
Note:
See TracChangeset
for help on using the changeset viewer.