From 1450f1d74a944fb111f705d050087fc1016d29a9 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Thu, 6 Jun 1996 15:31:36 +0000 Subject: (more_memory): Use assert_perror instead of MACH_CALL. "cthread_internals.h": Include removed. --- libthreads/malloc.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/libthreads/malloc.c b/libthreads/malloc.c index 961897d4..abf971f7 100644 --- a/libthreads/malloc.c +++ b/libthreads/malloc.c @@ -26,6 +26,14 @@ /* * HISTORY * $Log: malloc.c,v $ + * Revision 1.6 1996/03/07 21:13:08 miles + * (realloc): + * Use LOG2_MIN_SIZE. + * Don't bother allocating a new block if the new size request fits in the old + * one and doesn't waste any space. + * Only free the old block if we successfully got a new one. + * (LOG2_MIN_SIZE): New macro. + * * Revision 1.5 1996/03/06 23:51:04 miles * [MCHECK] (struct header): New type. * (union header): Only define if !MCHECK. @@ -80,9 +88,7 @@ #include - #include -#include "cthread_internals.h" #define MCHECK @@ -165,14 +171,15 @@ more_memory(size, fl) if (size <= vm_page_size) { amount = vm_page_size; n = vm_page_size / size; - /* - * We lose vm_page_size - n*size bytes here. - */ + /* We lose vm_page_size - n*size bytes here. */ } else { amount = size; n = 1; } - MACH_CALL(vm_allocate(mach_task_self(), &where, (vm_size_t) amount, TRUE), r); + + r = vm_allocate(mach_task_self(), &where, (vm_size_t) amount, TRUE); + assert_perror (r); + h = (header_t) where; do { HEADER_NEXT (h) = fl->head; -- cgit v1.2.3