| 442 | |
| 443 | |
| 444 | LIST * hcache( TARGET * t, int rec, regexp * re[], LIST * hdrscan ) |
| 445 | { |
| 446 | HCACHEDATA * c; |
| 447 | |
| 448 | ++queries; |
| 449 | |
| 450 | if ( ( c = (HCACHEDATA *)hash_find( hcachehash, t->boundname ) ) ) |
| 451 | { |
| 452 | if ( !timestamp_cmp( &c->time, &t->time ) ) |
| 453 | { |
| 454 | LIST * const l1 = hdrscan; |
| 455 | LIST * const l2 = c->hdrscan; |
| 456 | LISTITER iter1 = list_begin( l1 ); |
| 457 | LISTITER const end1 = list_end( l1 ); |
| 458 | LISTITER iter2 = list_begin( l2 ); |
| 459 | LISTITER const end2 = list_end( l2 ); |
| 460 | while ( iter1 != end1 && iter2 != end2 ) |
| 461 | { |
| 462 | if ( !object_equal( list_item( iter1 ), list_item( iter2 ) ) ) |
| 463 | iter1 = end1; |
| 464 | else |
| 465 | { |
| 466 | iter1 = list_next( iter1 ); |
| 467 | iter2 = list_next( iter2 ); |
| 468 | } |
| 469 | } |
| 470 | if ( iter1 != end1 || iter2 != end2 ) |
| 471 | { |
| 472 | if ( DEBUG_HEADER ) |
| 473 | { |
| 474 | out_printf( "HDRSCAN out of date in cache for %s\n", |
| 475 | object_str( t->boundname ) ); |
| 476 | out_printf(" real : "); |
| 477 | list_print( hdrscan ); |
| 478 | out_printf( "\n cached: " ); |
| 479 | list_print( c->hdrscan ); |
| 480 | out_printf( "\n" ); |
| 481 | } |
| 482 | |
| 483 | list_free( c->includes ); |
| 484 | list_free( c->hdrscan ); |
| 485 | c->includes = L0; |
| 486 | c->hdrscan = L0; |
| 487 | } |
| 488 | else |
| 489 | { |
| 490 | if ( DEBUG_HEADER ) |
| 491 | out_printf( "using header cache for %s\n", object_str( |
| 492 | t->boundname ) ); |
| 493 | c->age = 0; |
| 494 | ++hits; |
| 495 | return list_copy( c->includes ); |
| 496 | } |
| 497 | } |
| 498 | else |
| 499 | { |
| 500 | if ( DEBUG_HEADER ) |
| 501 | out_printf ("header cache out of date for %s\n", object_str( |
no test coverage detected