From ccf964b4c2b384d4e005a358f781e49cd6f89c68 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 5 Sep 2002 05:54:26 +0000 Subject: split-out memalign and realloc -Erik --- libc/stdlib/malloc-930716/malloc.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'libc/stdlib/malloc-930716/malloc.h') diff --git a/libc/stdlib/malloc-930716/malloc.h b/libc/stdlib/malloc-930716/malloc.h index fc21a13cc..bd315f788 100644 --- a/libc/stdlib/malloc-930716/malloc.h +++ b/libc/stdlib/malloc-930716/malloc.h @@ -10,6 +10,15 @@ #include + +#define MIN(x,y) ({ \ + const typeof(x) _x = (x); \ + const typeof(y) _y = (y); \ + (void) (&_x == &_y); \ + _x < _y ? _x : _y; }) + + + /* The allocator divides the heap into blocks of fixed size; large requests receive one or more whole blocks, and small requests receive a fragment of a block. Fragment sizes are powers of two, @@ -60,3 +69,21 @@ struct list { struct list *prev; }; +/* List of blocks allocated with memalign or valloc */ +struct alignlist +{ + struct alignlist *next; + __ptr_t aligned; /* The address that memaligned returned. */ + __ptr_t exact; /* The address that malloc returned. */ +}; +extern struct alignlist *_aligned_blocks; +extern char *_heapbase; +extern union info *_heapinfo; +extern size_t _heapindex; +extern size_t _heaplimit; + + +extern void *__malloc_unlocked (size_t size); +extern void __free_unlocked(void *ptr); + + -- cgit v1.2.3