| 119 | } |
| 120 | |
| 121 | static struct ps_map_entry * ps_map_insert(struct ps_map * map, LIST * key) |
| 122 | { |
| 123 | unsigned hash_val = list_hash( key ); |
| 124 | unsigned bucket = hash_val % map->table_size; |
| 125 | struct ps_map_entry * pos; |
| 126 | for ( pos = map->table[bucket]; pos ; pos = pos->next ) |
| 127 | { |
| 128 | if ( list_equal( pos->key, key ) ) |
| 129 | return pos; |
| 130 | } |
| 131 | |
| 132 | if ( map->num_elems >= map->table_size ) |
| 133 | { |
| 134 | ps_map_rehash( map ); |
| 135 | bucket = hash_val % map->table_size; |
| 136 | } |
| 137 | pos = (struct ps_map_entry *)BJAM_MALLOC( sizeof( struct ps_map_entry ) ); |
| 138 | pos->next = map->table[bucket]; |
| 139 | pos->key = key; |
| 140 | pos->value = 0; |
| 141 | map->table[bucket] = pos; |
| 142 | ++map->num_elems; |
| 143 | return pos; |
| 144 | } |
| 145 | |
| 146 | static struct ps_map all_property_sets; |
| 147 |
no test coverage detected