Changeset 7b0297b in mainline
- Timestamp:
- 2009-04-06T15:31:31Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 44814b8
- Parents:
- 5b7f418
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/adt/hash_table.c
r5b7f418 r7b0297b 33 33 /** 34 34 * @file 35 * @brief 35 * @brief Implementation of generic chained hash table. 36 36 * 37 37 * This file contains implementation of generic chained hash table. … … 57 57 58 58 ASSERT(h); 59 ASSERT(op && op->hash && op->compare); 59 ASSERT(op); 60 ASSERT(op->hash); 61 ASSERT(op->compare); 60 62 ASSERT(max_keys > 0); 61 63 62 64 h->entry = (link_t *) malloc(m * sizeof(link_t), 0); 63 if (!h->entry) {65 if (!h->entry) 64 66 panic("Cannot allocate memory for hash table."); 65 }67 66 68 memsetb(h->entry, m * sizeof(link_t), 0); 67 69 … … 83 85 { 84 86 index_t chain; 85 87 86 88 ASSERT(item); 87 ASSERT(h && h->op && h->op->hash && h->op->compare); 88 89 ASSERT(h); 90 ASSERT(h->op); 91 ASSERT(h->op->hash); 92 ASSERT(h->op->compare); 93 89 94 chain = h->op->hash(key); 90 95 ASSERT(chain < h->entries); … … 104 109 link_t *cur; 105 110 index_t chain; 106 107 ASSERT(h && h->op && h->op->hash && h->op->compare); 108 111 112 ASSERT(h); 113 ASSERT(h->op); 114 ASSERT(h->op->hash); 115 ASSERT(h->op->compare); 116 109 117 chain = h->op->hash(key); 110 118 ASSERT(chain < h->entries); … … 134 142 index_t chain; 135 143 link_t *cur; 136 137 ASSERT(h && h->op && h->op->hash && h->op->compare && h->op->remove_callback); 144 145 ASSERT(h); 146 ASSERT(h->op); 147 ASSERT(h->op->hash); 148 ASSERT(h->op->compare); 149 ASSERT(h->op->remove_callback); 138 150 ASSERT(keys <= h->max_keys); 139 151 140 152 if (keys == h->max_keys) { 141 153 142 154 /* 143 155 * All keys are known, hash_table_find() can be used to find the entry.
Note:
See TracChangeset
for help on using the changeset viewer.