| 89 | } |
| 90 | |
| 91 | void *ht_get( ht_t *ht, void *key ) |
| 92 | { |
| 93 | if( ht && key ) |
| 94 | { |
| 95 | hash_t hash = ( ht->key_hash ? ht->key_hash( key ) % HT_N_BUCKETS : (uint32_t)key % HT_N_BUCKETS ); |
| 96 | ht_entry_t *entry = NULL, |
| 97 | *bucket = NULL; |
| 98 | |
| 99 | bucket = ht->buckets[ hash ]; |
| 100 | |
| 101 | for( entry = bucket; entry; entry = entry->next ) |
| 102 | { |
| 103 | if( ht->key_cmp( key, entry->key ) == 0 ) |
| 104 | { |
| 105 | return entry->value; |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | return NULL; |
| 111 | } |
| 112 | |
| 113 | bool ht_first( ht_t *ht, ht_iterator_t *iter ) |
| 114 | { |
no outgoing calls
no test coverage detected