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

Function hcache_init

v2/engine/hcache.c:176–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174
175
176void hcache_init()
177{
178 FILE * f;
179 OBJECT * version = 0;
180 int header_count = 0;
181 const char * hcachename;
182
183 if ( hcachehash )
184 return;
185
186 hcachehash = hashinit( sizeof( HCACHEDATA ), "hcache" );
187
188 if ( !( hcachename = cache_name() ) )
189 return;
190
191 if ( !( f = fopen( hcachename, "rb" ) ) )
192 return;
193
194 version = read_netstring( f );
195
196 if ( !version || strcmp( object_str( version ), CACHE_FILE_VERSION ) )
197 goto bail;
198
199 while ( 1 )
200 {
201 HCACHEDATA cachedata;
202 HCACHEDATA * c;
203 OBJECT * record_type = 0;
204 OBJECT * time_secs_str = 0;
205 OBJECT * time_nsecs_str = 0;
206 OBJECT * age_str = 0;
207 OBJECT * includes_count_str = 0;
208 OBJECT * hdrscan_count_str = 0;
209 int i;
210 int count;
211 LIST * l;
212 int found;
213
214 cachedata.boundname = 0;
215 cachedata.includes = 0;
216 cachedata.hdrscan = 0;
217
218 record_type = read_netstring( f );
219 if ( !record_type )
220 {
221 fprintf( stderr, "invalid %s\n", hcachename );
222 goto cleanup;
223 }
224 if ( !strcmp( object_str( record_type ), CACHE_RECORD_END ) )
225 {
226 object_free( record_type );
227 break;
228 }
229 if ( strcmp( object_str( record_type ), CACHE_RECORD_HEADER ) )
230 {
231 fprintf( stderr, "invalid %s with record separator <%s>\n",
232 hcachename, record_type ? object_str( record_type ) : "<null>" );
233 goto cleanup;

Callers 1

makeFunction · 0.85

Calls 10

hashinitFunction · 0.85
cache_nameFunction · 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

Tested by

no test coverage detected