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

Function hcache_done

src/engine/hcache.cpp:355–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353
354
355void hcache_done()
356{
357 FILE * f;
358 HCACHEDATA * c;
359 int header_count = 0;
360 const char * hcachename;
361 int maxage;
362
363 if ( !hcachehash )
364 return;
365
366 if ( !( hcachename = cache_name() ) )
367 goto cleanup;
368
369 if ( !( f = fopen( hcachename, "wb" ) ) )
370 {
371 err_printf( "[errno %d] failed to write hcache file '%s': %s",
372 errno, hcachename, strerror(errno) );
373 goto cleanup;
374 }
375
376 maxage = cache_maxage();
377
378 /* Print out the version. */
379 write_netstring( f, CACHE_FILE_VERSION );
380
381 c = hcachelist;
382 for ( c = hcachelist; c; c = c->next )
383 {
384 LISTITER iter;
385 LISTITER end;
386 char time_secs_str[ 30 ];
387 char time_nsecs_str[ 30 ];
388 char age_str[ 30 ];
389 char includes_count_str[ 30 ];
390 char hdrscan_count_str[ 30 ];
391
392 if ( maxage == 0 )
393 c->age = 0;
394 else if ( c->age > maxage )
395 continue;
396
397 sprintf( includes_count_str, "%lu", (long unsigned)list_length(
398 c->includes ) );
399 sprintf( hdrscan_count_str, "%lu", (long unsigned)list_length(
400 c->hdrscan ) );
401 sprintf( time_secs_str, "%lu", (long unsigned)c->time.secs );
402 sprintf( time_nsecs_str, "%lu", (long unsigned)c->time.nsecs );
403 sprintf( age_str, "%lu", (long unsigned)c->age );
404
405 write_netstring( f, CACHE_RECORD_HEADER );
406 write_netstring( f, object_str( c->boundname ) );
407 write_netstring( f, time_secs_str );
408 write_netstring( f, time_nsecs_str );
409 write_netstring( f, age_str );
410 write_netstring( f, includes_count_str );
411 for ( iter = list_begin( c->includes ), end = list_end( c->includes );
412 iter != end; iter = list_next( iter ) )

Callers 1

mainFunction · 0.85

Calls 12

cache_nameFunction · 0.85
err_printfFunction · 0.85
cache_maxageFunction · 0.85
write_netstringFunction · 0.85
list_lengthFunction · 0.85
object_strFunction · 0.85
list_beginFunction · 0.85
list_endFunction · 0.85
out_printfFunction · 0.85
list_freeFunction · 0.85
object_freeFunction · 0.85
hashdoneFunction · 0.85

Tested by

no test coverage detected