| 198 | } |
| 199 | |
| 200 | void ht_destroy( ht_t *ht ) |
| 201 | { |
| 202 | ht_entry_t *entry = NULL, |
| 203 | *bucket = NULL; |
| 204 | hash_t hash = 0; |
| 205 | |
| 206 | for( hash = 0; hash < HT_N_BUCKETS; ++hash ) |
| 207 | { |
| 208 | entry = ht->buckets[ hash ]; |
| 209 | while( entry ) |
| 210 | { |
| 211 | ht_entry_t *next = entry->next; |
| 212 | |
| 213 | if( ht->key_free ) |
| 214 | ht->key_free( entry->key ); |
| 215 | |
| 216 | if( ht->val_free ) |
| 217 | ht->val_free( entry->value ); |
| 218 | |
| 219 | free( entry ); |
| 220 | |
| 221 | entry = next; |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | free( ht ); |
| 226 | } |
| 227 | |
| 228 | int32_t ht_qword_cmp( void *a, void *b ) |
| 229 | { |
no outgoing calls
no test coverage detected