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

Function hcache_init

src/engine/hcache.cpp:182–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180
181
182void hcache_init()
183{
184 FILE * f;
185 OBJECT * version = 0;
186 int header_count = 0;
187 const char * hcachename;
188
189 if ( hcachehash )
190 return;
191
192 hcachehash = hashinit( sizeof( HCACHEDATA ), "hcache" );
193
194 if ( !( hcachename = cache_name() ) )
195 return;
196
197 if ( !( f = fopen( hcachename, "rb" ) ) )
198 {
199 if ( errno != ENOENT )
200 err_printf( "[errno %d] failed to read hcache file '%s': %s",
201 errno, hcachename, strerror(errno) );
202 return;
203 }
204
205 version = read_netstring( f );
206
207 if ( !version || strcmp( object_str( version ), CACHE_FILE_VERSION ) )
208 goto bail;
209
210 while ( 1 )
211 {
212 HCACHEDATA cachedata;
213 HCACHEDATA * c;
214 OBJECT * record_type = 0;
215 OBJECT * time_secs_str = 0;
216 OBJECT * time_nsecs_str = 0;
217 OBJECT * age_str = 0;
218 OBJECT * includes_count_str = 0;
219 OBJECT * hdrscan_count_str = 0;
220 int i;
221 int count;
222 LIST * l;
223 int found;
224
225 cachedata.boundname = 0;
226 cachedata.includes = 0;
227 cachedata.hdrscan = 0;
228
229 record_type = read_netstring( f );
230 if ( !record_type )
231 {
232 err_printf( "invalid %s\n", hcachename );
233 goto cleanup;
234 }
235 if ( !strcmp( object_str( record_type ), CACHE_RECORD_END ) )
236 {
237 object_free( record_type );
238 break;
239 }

Callers 1

makeFunction · 0.85

Calls 12

hashinitFunction · 0.85
cache_nameFunction · 0.85
err_printfFunction · 0.85
read_netstringFunction · 0.85
object_strFunction · 0.85
object_freeFunction · 0.85
timestamp_initFunction · 0.85
list_freeFunction · 0.85
list_push_backFunction · 0.85
hash_insertFunction · 0.85
timestamp_copyFunction · 0.85
out_printfFunction · 0.85

Tested by

no test coverage detected