Commit 8433987d authored by Rich Prohaska's avatar Rich Prohaska

short cut pma_free

add some debug asserts to pma_free



git-svn-id: file:///svn/tokudb@147 c7de825b-a66e-492c-adef-691d508d4ae1
parent 471ad43c
......@@ -72,6 +72,7 @@ static void test_make_space_at (void) {
}
}
}
pma->n_pairs_present = 0;
r=pma_free(&pma); assert(r==0);
assert(pma==0);
kv_pair_free(key_A);
......
......@@ -528,13 +528,19 @@ enum pma_errors pma_lookup (PMA pma, DBT *k, DBT *v, DB *db) {
int pma_free (PMA *pmap) {
int i;
PMA pma=*pmap;
if (!list_empty(&pma->cursors)) return -1;
for (i=0; i<pma_index_limit(pma); i++) {
if (pma->pairs[i]) {
kv_pair_free(pma->pairs[i]);
pma->pairs[i] = 0;
if (!list_empty(&pma->cursors))
return -1;
if (pma->n_pairs_present > 0) {
for (i=0; i < pma->N; i++) {
if (pma->pairs[i]) {
kv_pair_free(pma->pairs[i]);
pma->pairs[i] = 0;
pma->n_pairs_present--;
}
}
}
assert(pma->n_pairs_present == 0);
toku_free(pma->pairs);
if (pma->skey) toku_free(pma->skey);
if (pma->sval) toku_free(pma->sval);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment