From 0a110e1d2a14e390c48a4c966dca54bf6a0efc1b Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Fri, 10 May 1996 21:16:35 +0000 Subject: (_make_store): Initialize CHILDREN & NUM_CHILDREN. Use store_run, not off_t, vectors; tweak accordingly. (store_free): Free all children too. --- libstore/make.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'libstore/make.c') 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); } -- cgit v1.2.3