/* Clears remaining memory of the path repo */ static apr_status_t pr_cleanup(void *data) { path_repo_t *repo = data; int i; #ifdef DEBUG L1("path_repo: snapshot interval: %d\n", SNAPSHOT_INTERVAL); L1("path_repo: cache size: %d\n", CACHE_SIZE); L1("path_repo: stored deltas: %d kB\n", repo->delta_bytes / 1024); L1("path_repo: stored deltas (raw): %d kB\n", repo->delta_bytes_raw / 1024); L1("path_repo: total recon time: %ld ms\n", apr_time_msec(repo->recon_time)); L1("path_repo: total store time: %ld ms\n", apr_time_msec(repo->store_time)); L1("path_repo: cache miss rate: %.2f%% (%d of %d)\n", 100.0f*repo->cache_misses / (repo->cache_hits+repo->cache_misses), repo->cache_misses, (repo->cache_hits+repo->cache_misses)); #endif cb_tree_clear(&repo->tree); for (i = 0; i < repo->cache->nelts; i++) { if (APR_ARRAY_IDX(repo->cache, i, pr_cache_entry_t).tree.root) { cb_tree_clear(&APR_ARRAY_IDX(repo->cache, i, pr_cache_entry_t).tree); } } mukv_close(repo->db); #ifdef USE_SNAPPY snappy_free_env(&repo->snappy_env); #endif return APR_SUCCESS; }
/* Program entry point */ int main(int argc, char **argv) { cb_tree_t tree = cb_tree_make(); printf("%d ", ++tnum); fflush(stdout); test_insert(&tree); printf("%d ", ++tnum); fflush(stdout); test_complete(&tree, sizeof(dict) / sizeof(const char *)); printf("%d ", ++tnum); fflush(stdout); test_insert_dup(&tree); printf("%d ", ++tnum); fflush(stdout); test_contains(&tree); printf("%d ", ++tnum); fflush(stdout); test_delete(&tree); printf("%d ", ++tnum); fflush(stdout); cb_tree_clear(&tree); test_insert(&tree); test_complete(&tree, sizeof(dict) / sizeof(const char *)); printf("%d ", ++tnum); fflush(stdout); test_delete_all(&tree); printf("%d ", ++tnum); fflush(stdout); test_complete(&tree, 0); printf("%d ", ++tnum); fflush(stdout); cb_tree_clear(&tree); test_empty(&tree); printf("%d ", ++tnum); fflush(stdout); test_insert(&tree); test_prefixes(&tree); cb_tree_clear(&tree); printf("ok\n"); return 0; }