123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- #include <sys/cdefs.h>
- extern void *(*__morecore)(long);
- extern void *__default_morecore_init(long);
- extern void *__default_morecore(long);
- #define INT_BIT (CHAR_BIT * sizeof (int))
- #define BLOCKLOG (INT_BIT > 16 ? 12 : 9)
- #define BLOCKSIZE (1 << BLOCKLOG)
- #define BLOCKIFY(SIZE) (((SIZE) + BLOCKSIZE - 1) / BLOCKSIZE)
- #define HEAP (INT_BIT > 16 ? 4194304 : 65536)
- #define FINAL_FREE_BLOCKS 8
- union info {
- struct {
- int type;
- union {
- struct {
- int nfree;
- int first;
- } frag;
- int size;
- } info;
- } busy;
- struct {
- int size;
- int next;
- int prev;
- } free;
- };
- extern char *_heapbase;
- extern union info *_heapinfo;
- #define BLOCK(A) (((char *) (A) - _heapbase) / BLOCKSIZE + 1)
- #define ADDRESS(B) ((void *) (((B) - 1) * BLOCKSIZE + _heapbase))
- extern int _heapindex;
- extern int _heaplimit;
- struct list {
- struct list *next;
- struct list *prev;
- };
- extern int _fragblocks[];
- extern struct list _fraghead[];
- struct alignlist
- {
- struct alignlist *next;
- __ptr_t aligned;
- __ptr_t exact;
- };
- extern struct alignlist *_aligned_blocks;
- extern void _free_internal __P ((__ptr_t __ptr));
- extern void free (void *);
- extern void * malloc (size_t);
- extern void * calloc (size_t, size_t);
- extern void * valloc (size_t);
- extern void * memalign (size_t, size_t);
- extern void * realloc (void *, size_t);
|