Commit cda74f78 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 1cd311c0
...@@ -72,6 +72,7 @@ static void test_make_space_at (void) { ...@@ -72,6 +72,7 @@ static void test_make_space_at (void) {
} }
} }
} }
pma->n_pairs_present = 0;
r=pma_free(&pma); assert(r==0); r=pma_free(&pma); assert(r==0);
assert(pma==0); assert(pma==0);
kv_pair_free(key_A); kv_pair_free(key_A);
......
...@@ -528,13 +528,19 @@ enum pma_errors pma_lookup (PMA pma, DBT *k, DBT *v, DB *db) { ...@@ -528,13 +528,19 @@ enum pma_errors pma_lookup (PMA pma, DBT *k, DBT *v, DB *db) {
int pma_free (PMA *pmap) { int pma_free (PMA *pmap) {
int i; int i;
PMA pma=*pmap; PMA pma=*pmap;
if (!list_empty(&pma->cursors)) return -1; if (!list_empty(&pma->cursors))
for (i=0; i<pma_index_limit(pma); i++) { return -1;
if (pma->pairs[i]) {
kv_pair_free(pma->pairs[i]); if (pma->n_pairs_present > 0) {
pma->pairs[i] = 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); toku_free(pma->pairs);
if (pma->skey) toku_free(pma->skey); if (pma->skey) toku_free(pma->skey);
if (pma->sval) toku_free(pma->sval); 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