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

Function ps_map_insert

v2/engine/modules/property-set.c:120–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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