Rev 4246 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4246 | Rev 4249 | ||
|---|---|---|---|
| Line 129... | Line 129... | ||
| 129 | return NULL; |
129 | return NULL; |
| 130 | } |
130 | } |
| 131 | 131 | ||
| 132 | /** Remove all matching items from hash table. |
132 | /** Remove all matching items from hash table. |
| 133 | * |
133 | * |
| 134 | * For each removed item, h->remove_callback() is called. |
134 | * For each removed item, h->remove_callback() is called (if not NULL). |
| 135 | * |
135 | * |
| 136 | * @param h Hash table. |
136 | * @param h Hash table. |
| 137 | * @param key Array of keys that will be compared against items of the hash table. |
137 | * @param key Array of keys that will be compared against items of the hash table. |
| 138 | * @param keys Number of keys in the key array. |
138 | * @param keys Number of keys in the key array. |
| 139 | */ |
139 | */ |
| Line 144... | Line 144... | ||
| 144 | 144 | ||
| 145 | ASSERT(h); |
145 | ASSERT(h); |
| 146 | ASSERT(h->op); |
146 | ASSERT(h->op); |
| 147 | ASSERT(h->op->hash); |
147 | ASSERT(h->op->hash); |
| 148 | ASSERT(h->op->compare); |
148 | ASSERT(h->op->compare); |
| 149 | ASSERT(h->op->remove_callback); |
- | |
| 150 | ASSERT(keys <= h->max_keys); |
149 | ASSERT(keys <= h->max_keys); |
| 151 | 150 | ||
| 152 | if (keys == h->max_keys) { |
151 | if (keys == h->max_keys) { |
| 153 | 152 | ||
| 154 | /* |
153 | /* |
| Line 156... | Line 155... | ||
| 156 | */ |
155 | */ |
| 157 | 156 | ||
| 158 | cur = hash_table_find(h, key); |
157 | cur = hash_table_find(h, key); |
| 159 | if (cur) { |
158 | if (cur) { |
| 160 | list_remove(cur); |
159 | list_remove(cur); |
| - | 160 | if (h->op->remove_callback) |
|
| 161 | h->op->remove_callback(cur); |
161 | h->op->remove_callback(cur); |
| 162 | } |
162 | } |
| 163 | return; |
163 | return; |
| 164 | } |
164 | } |
| 165 | 165 | ||
| 166 | /* |
166 | /* |
| Line 174... | Line 174... | ||
| 174 | 174 | ||
| 175 | hlp = cur; |
175 | hlp = cur; |
| 176 | cur = cur->prev; |
176 | cur = cur->prev; |
| 177 | 177 | ||
| 178 | list_remove(hlp); |
178 | list_remove(hlp); |
| - | 179 | if (h->op->remove_callback) |
|
| 179 | h->op->remove_callback(hlp); |
180 | h->op->remove_callback(hlp); |
| 180 | 181 | ||
| 181 | continue; |
182 | continue; |
| 182 | } |
183 | } |
| 183 | } |
184 | } |
| 184 | } |
185 | } |