summaryrefslogtreecommitdiff
path: root/libstore
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-05-10 21:16:35 +0000
committerMiles Bader <miles@gnu.org>1996-05-10 21:16:35 +0000
commit0a110e1d2a14e390c48a4c966dca54bf6a0efc1b (patch)
treeaf8ef251ec3bf53a90f94c1d09b15797edd789af /libstore
parentf43adf7ec562a1c5a2cde7ecca2e8bc873c19bcf (diff)
(_make_store):
Initialize CHILDREN & NUM_CHILDREN. Use store_run, not off_t, vectors; tweak accordingly. (store_free): Free all children too.
Diffstat (limited to 'libstore')
-rw-r--r--libstore/make.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libstore/make.c b/libstore/make.c
index 7ce320d5..d13f2516 100644
--- a/libstore/make.c
+++ b/libstore/make.c
@@ -29,7 +29,7 @@
struct store *
_make_store (enum file_storage_class class, struct store_meths *meths,
mach_port_t port, size_t block_size,
- const off_t *runs, size_t num_runs, off_t end)
+ const struct store_run *runs, size_t num_runs, off_t end)
{
if (block_size & (block_size - 1))
return 0; /* block size not a power of two. */
@@ -53,6 +53,8 @@ _make_store (enum file_storage_class class, struct store_meths *meths,
store->log2_blocks_per_page = 0;
store->misc = 0;
store->hook = 0;
+ store->children = 0;
+ store->num_children = 0;
store->class = class;
store->meths = meths;
@@ -66,15 +68,23 @@ _make_store (enum file_storage_class class, struct store_meths *meths,
void
store_free (struct store *store)
{
+ int k;
+
if (store->meths->cleanup)
(*store->meths->cleanup) (store);
+
+ for (k = 0; k < store->num_children; k++)
+ store_free (store->children[k]);
+
if (store->port != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self (), store->port);
if (store->source != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self (), store->source);
+
if (store->name)
free (store->name);
if (store->runs)
free (store->runs);
+
free (store);
}