From 056f9d98941eb98e453bf4fa308f28b892525baf Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Thu, 25 Jul 2002 01:58:57 +0000 Subject: Redo the locking, so that it may actually work. Now locking is done at the malloc/free level, not within the heap abstraction, and there's a separate lock to control sbrk access. Also, get rid of the separate `unmap_free_area' function in free.c, and just put the code in the `free' function directly, which saves a bunch of space (even compared to using an inline function) for some reason. --- libc/stdlib/malloc/realloc.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libc/stdlib/malloc/realloc.c') diff --git a/libc/stdlib/malloc/realloc.c b/libc/stdlib/malloc/realloc.c index 7d8227aff..7a89712e3 100644 --- a/libc/stdlib/malloc/realloc.c +++ b/libc/stdlib/malloc/realloc.c @@ -39,7 +39,10 @@ realloc (void *mem, size_t new_size) size_t ext_size = new_size - size; void *ext_addr = (char *)base_mem + ext_size; + __malloc_lock (); ext_size = __heap_alloc_at (&__malloc_heap, ext_addr, ext_size); + __malloc_unlock (); + if (! ext_size) /* Our attempts to extend MEM in place failed, just allocate-and-copy. */ -- cgit v1.2.3