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

Function path_key

src/engine/pathnt.cpp:231–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229
230
231static path_key_entry * path_key( OBJECT * const path,
232 int const known_to_be_canonic )
233{
234 path_key_entry * result;
235 int found;
236
237 if ( !path_key_cache )
238 path_key_cache = hashinit( sizeof( path_key_entry ), "path to key" );
239
240 result = (path_key_entry *)hash_insert( path_key_cache, path, &found );
241 if ( !found )
242 {
243 OBJECT * normalized;
244 int32_t normalized_size;
245 path_key_entry * nresult;
246 result->path = path;
247 {
248 string buf[ 1 ];
249 string_copy( buf, object_str( path ) );
250 normalize_path( buf );
251 normalized = object_new( buf->value );
252 normalized_size = buf->size;
253 string_free( buf );
254 }
255 nresult = (path_key_entry *)hash_insert( path_key_cache, normalized,
256 &found );
257 if ( !found || nresult == result )
258 {
259 nresult->path = normalized;
260 if ( known_to_be_canonic )
261 {
262 nresult->key = object_copy( path );
263 nresult->exists = 1;
264 }
265 else
266 {
267 string canonic_path[ 1 ];
268 string_new( canonic_path );
269 if ( canonicWindowsPath( object_str( normalized ), normalized_size,
270 canonic_path ) )
271 nresult->exists = 1;
272 else
273 nresult->exists = 0;
274 nresult->key = object_new( canonic_path->value );
275 string_free( canonic_path );
276 }
277 }
278 else
279 object_free( normalized );
280 if ( nresult != result )
281 {
282 result->path = object_copy( path );
283 result->key = object_copy( nresult->key );
284 result->exists = nresult->exists;
285 }
286 }
287
288 return result;

Callers 2

path_register_keyFunction · 0.85
path_as_keyFunction · 0.85

Calls 11

hashinitFunction · 0.85
hash_insertFunction · 0.85
string_copyFunction · 0.85
object_strFunction · 0.85
normalize_pathFunction · 0.85
object_newFunction · 0.85
string_freeFunction · 0.85
object_copyFunction · 0.85
string_newFunction · 0.85
canonicWindowsPathFunction · 0.85
object_freeFunction · 0.85

Tested by

no test coverage detected