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

Function hash_insert

src/engine/hash.cpp:149–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147 */
148
149HASHDATA * hash_insert( struct hash * hp, OBJECT * key, int32_t * found )
150{
151 ITEM * i;
152 uint32_t keyval = hash_keyval( key );
153
154 #ifdef HASH_DEBUG_PROFILE
155 profile_frame prof[ 1 ];
156 if ( DEBUG_PROFILE )
157 profile_enter( 0, prof );
158 #endif
159
160 if ( !hp->items.more )
161 hashrehash( hp );
162
163 i = hash_search( hp, keyval, key, 0 );
164 if ( i )
165 *found = 1;
166 else
167 {
168 ITEM * * base = hash_bucket( hp, keyval );
169
170 /* Try to grab one from the free list. */
171 if ( hp->items.free )
172 {
173 i = hp->items.free;
174 hp->items.free = i->next;
175 assert( !hash_item_key( i ) );
176 }
177 else
178 {
179 i = (ITEM *)hp->items.next;
180 hp->items.next += hp->items.size;
181 }
182 --hp->items.more;
183 i->next = *base;
184 *base = i;
185 *found = 0;
186 }
187
188 #ifdef HASH_DEBUG_PROFILE
189 if ( DEBUG_PROFILE )
190 profile_exit( prof );
191 #endif
192
193 return hash_item_data( i );
194}
195
196
197/*

Callers 15

make_class_moduleFunction · 0.85
var_enterFunction · 0.85
regex_compileFunction · 0.85
file_archive_infoFunction · 0.85
file_infoFunction · 0.85
bindmoduleFunction · 0.85
stat_moduleFunction · 0.85
import_moduleFunction · 0.85
module_add_fixed_varFunction · 0.85
enter_ruleFunction · 0.85
bindtargetFunction · 0.85
set_explicit_bindingFunction · 0.85

Calls 5

profile_enterFunction · 0.85
hashrehashFunction · 0.85
hash_searchFunction · 0.85
profile_exitFunction · 0.85
hash_keyvalFunction · 0.70

Tested by

no test coverage detected