Changeset bd08239 in mainline for kernel/generic/src/adt/hash_table.c
- Timestamp:
- 2011-06-18T15:35:25Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 44e2c1a
- Parents:
- 313775b (diff), adfdbd5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/adt/hash_table.c
r313775b rbd08239 62 62 ASSERT(max_keys > 0); 63 63 64 h->entry = (li nk_t *) malloc(m * sizeof(link_t), 0);64 h->entry = (list_t *) malloc(m * sizeof(list_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 nk_t), 0);68 memsetb(h->entry, m * sizeof(list_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;110 109 size_t chain; 111 110 … … 118 117 ASSERT(chain < h->entries); 119 118 120 for (cur = h->entry[chain].next; cur != &h->entry[chain]; cur = cur->next) {119 list_foreach(h->entry[chain], cur) { 121 120 if (h->op->compare(key, h->max_keys, cur)) { 122 121 /* … … 141 140 { 142 141 size_t chain; 143 link_t *cur;144 142 145 143 ASSERT(h); … … 150 148 151 149 if (keys == h->max_keys) { 150 link_t *cur; 152 151 153 152 /* … … 169 168 */ 170 169 for (chain = 0; chain < h->entries; chain++) { 171 for (cur = h->entry[chain].next; cur != &h->entry[chain]; cur = cur->next) {170 list_foreach(h->entry[chain], cur) { 172 171 if (h->op->compare(key, keys, cur)) { 173 172 link_t *hlp;
Note:
See TracChangeset
for help on using the changeset viewer.