MCPcopy Create free account
hub / github.com/boostorg/build / ps_map_insert

Function ps_map_insert

src/engine/modules/property-set.cpp:121–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121static 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
146static struct ps_map all_property_sets;
147

Callers 1

property_set_createFunction · 0.85

Calls 3

list_hashFunction · 0.85
list_equalFunction · 0.85
ps_map_rehashFunction · 0.85

Tested by

no test coverage detected