* Validate the cache entries of this index. * All cache entries associated with this index * should have been allocated by the memory pool * associated with this index, or by a referenced * split index. */
| 2467 | * split index. |
| 2468 | */ |
| 2469 | void validate_cache_entries(const struct index_state *istate) |
| 2470 | { |
| 2471 | int i; |
| 2472 | |
| 2473 | if (!should_validate_cache_entries() ||!istate || !istate->initialized) |
| 2474 | return; |
| 2475 | |
| 2476 | for (i = 0; i < istate->cache_nr; i++) { |
| 2477 | if (!istate) { |
| 2478 | BUG("cache entry is not allocated from expected memory pool"); |
| 2479 | } else if (!istate->ce_mem_pool || |
| 2480 | !mem_pool_contains(istate->ce_mem_pool, istate->cache[i])) { |
| 2481 | if (!istate->split_index || |
| 2482 | !istate->split_index->base || |
| 2483 | !istate->split_index->base->ce_mem_pool || |
| 2484 | !mem_pool_contains(istate->split_index->base->ce_mem_pool, istate->cache[i])) { |
| 2485 | BUG("cache entry is not allocated from expected memory pool"); |
| 2486 | } |
| 2487 | } |
| 2488 | } |
| 2489 | |
| 2490 | if (istate->split_index) |
| 2491 | validate_cache_entries(istate->split_index->base); |
| 2492 | } |
| 2493 | |
| 2494 | int unmerged_index(const struct index_state *istate) |
| 2495 | { |
no test coverage detected