summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc
diff options
context:
space:
mode:
authorMiles Bader <miles@lsi.nec.co.jp>2002-09-04 02:09:13 +0000
committerMiles Bader <miles@lsi.nec.co.jp>2002-09-04 02:09:13 +0000
commit4d5bd6060d182c4987b679367c201eaf94e91812 (patch)
tree250f88ac5afeda20e5b9e49cd120be8d61448199 /libc/stdlib/malloc
parentfce085a455a9429386ac14a75be1d11d8bd842f8 (diff)
(__heap_delete): Renamed from `__heap_unlink_free_area'.
(__heap_free_area_alloc): Use __heap_delete. (__heap_is_empty): New macro.
Diffstat (limited to 'libc/stdlib/malloc')
-rw-r--r--libc/stdlib/malloc/heap.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/libc/stdlib/malloc/heap.h b/libc/stdlib/malloc/heap.h
index da63b4341..6b370fd5e 100644
--- a/libc/stdlib/malloc/heap.h
+++ b/libc/stdlib/malloc/heap.h
@@ -115,9 +115,9 @@ static void HEAP_DEBUG (struct heap *heap, const char *str)
#endif
-/* Remove the free-area FA from HEAP. */
+/* Delete the free-area FA from HEAP. */
extern inline void
-__heap_unlink_free_area (struct heap *heap, struct heap_free_area *fa)
+__heap_delete (struct heap *heap, struct heap_free_area *fa)
{
if (fa->next)
fa->next->prev = fa->prev;
@@ -193,7 +193,7 @@ __heap_free_area_alloc (struct heap *heap,
/* There's not enough room left over in FA after allocating the block, so
just use the whole thing, removing it from the list of free areas. */
{
- __heap_unlink_free_area (heap, fa);
+ __heap_delete (heap, fa);
/* Remember that we've alloced the whole area. */
size = fa_size;
}
@@ -218,3 +218,6 @@ extern size_t __heap_alloc_at (struct heap *heap, void *mem, size_t size);
Returns the heap free area into which the memory was placed. */
extern struct heap_free_area *__heap_free (struct heap *heap,
void *mem, size_t size);
+
+/* Return true if HEAP contains absolutely no memory. */
+#define __heap_is_empty(heap) (! (heap)->free_areas)