From 1584a9200a511a6ce330917be8dcaf957bb7c2e2 Mon Sep 17 00:00:00 2001 From: Thomas Bushnell Date: Sat, 3 Jul 1999 23:53:01 +0000 Subject: 1999-07-03 Thomas Bushnell, BSG * bunzip2.c (bunzip2): Use munmap instead of vm_deallocate. (store_bunzip2_create): Likewise. * rdwr.c (store_read): Likewise. * gunzip.c (gunzip): Likewise. (store_gunzip_create): Likewise. * enc.c (store_enc_dealloc): Likewise. * copy.c (copy_cleanup): Likewise. --- libstore/bunzip2.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'libstore/bunzip2.c') diff --git a/libstore/bunzip2.c b/libstore/bunzip2.c index a09aa9f6..71a69db6 100644 --- a/libstore/bunzip2.c +++ b/libstore/bunzip2.c @@ -101,8 +101,7 @@ bunzip2 (struct store *from, void **buf, size_t *buf_len) if (new_in_buf != in_buf) { if (in_buf_len > 0) - vm_deallocate (mach_task_self (), - (vm_address_t)in_buf, in_buf_len); + munmap (in_buf, in_buf_len); in_buf = new_in_buf; in_buf_len = new_in_buf_len; } @@ -146,8 +145,7 @@ bunzip2 (struct store *from, void **buf, size_t *buf_len) /* Copy the old buffer into the start of the new & free it. */ bcopy (old_buf, new_buf, out_buf_offs); - vm_deallocate (mach_task_self (), - (vm_address_t)old_buf, old_buf_len); + munmap (old_buf, old_buf_len); *buf = new_buf; } @@ -193,20 +191,19 @@ bunzip2 (struct store *from, void **buf, size_t *buf_len) mutex_unlock (&bunzip2_lock); if (in_buf_len > 0) - vm_deallocate (mach_task_self (), (vm_address_t)in_buf, in_buf_len); + munmap (in_buf, in_buf_len); if (zerr) { if (*buf_len > 0) - vm_deallocate (mach_task_self (), (vm_address_t)*buf, *buf_len); + munmap (*buf, *buf_len); } else if (out_buf_offs < *buf_len) /* Trim the output buffer to be the right length. */ { size_t end = round_page (out_buf_offs); if (end < *buf_len) - vm_deallocate (mach_task_self (), - (vm_address_t)(*buf + end), *buf_len - end); + munmap (*buf + end, *buf_len - end); *buf_len = out_buf_offs; } @@ -226,7 +223,7 @@ store_bunzip2_create (struct store *from, int flags, struct store **store) { err = store_buffer_create (buf, buf_len, flags, store); if (err) - vm_deallocate (mach_task_self (), (vm_address_t)buf, buf_len); + munmap (buf, buf_len); else store_free (from); } -- cgit v1.2.3