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

Function ps_map_rehash

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

Source from the content-addressed store, hash-verified

91}
92
93static void ps_map_rehash( struct ps_map * map )
94{
95 struct ps_map old = *map;
96 int32_t i;
97 map->table = (struct ps_map_entry * *)BJAM_MALLOC( size_t(map->table_size) * 2 * sizeof( struct ps_map_entry * ) );
98 map->table_size *= 2;
99 for ( i = 0; i < map->table_size; ++i )
100 {
101 map->table[ i ] = NULL;
102 }
103 for ( i = 0; i < old.table_size; ++i )
104 {
105 struct ps_map_entry * pos;
106 for ( pos = old.table[ i ]; pos; )
107 {
108 struct ps_map_entry * tmp = pos->next;
109
110 unsigned hash_val = list_hash( pos->key );
111 unsigned bucket = hash_val % map->table_size;
112 pos->next = map->table[ bucket ];
113 map->table[ bucket ] = pos;
114
115 pos = tmp;
116 }
117 }
118 BJAM_FREE( old.table );
119}
120
121static struct ps_map_entry * ps_map_insert(struct ps_map * map, LIST * key)
122{

Callers 1

ps_map_insertFunction · 0.85

Calls 1

list_hashFunction · 0.85

Tested by

no test coverage detected