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

Function ps_map_rehash

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

Source from the content-addressed store, hash-verified

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

Callers 1

ps_map_insertFunction · 0.85

Calls 1

list_hashFunction · 0.85

Tested by

no test coverage detected