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

Function hash_insert

v2/engine/hash.c:148–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 15

file_infoFunction · 0.85
hcache_initFunction · 0.85
hcacheFunction · 0.85
regex_compileFunction · 0.85
canonicWindowsPathFunction · 0.85
path_keyFunction · 0.85
time_enterFunction · 0.85
var_enterFunction · 0.85
macro_headersFunction · 0.85
bindmoduleFunction · 0.85
stat_moduleFunction · 0.85
import_moduleFunction · 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