|
|
1.1 root 1: /* (-lgl
2: * COHERENT Version 3.1.0
3: * Copyright (c) 1982, 1990 by Mark Williams Company.
4: * All rights reserved. May not be copied without permission.
5: -lgl) */
6: /*
7: * malloc.h
8: * Header file for malloc.c, notmem.c, realloc.c.
9: */
10:
11: #ifndef MALLOC_H
12: #define MALLOC_H
13:
14: /* Manifest constants. */
15: /*
16: * N.B. 2^ARENASIZE must be greater than sizeof(struct mblock)
17: * so that malloc.c/newarena() does not cause trouble when it combines arenas.
18: */
19: #define ARENASIZE 11 /* round arena sizes up to 2^11==2048 */
20: #define BADSBRK ((char *)-1) /* sbrk() failure return value */
21: #define BLOCKSIZE 1 /* round block sizes up to 2^1==2 */
22: #define DECRSIZE 256 /* arena size decrement at end */
23: #define FREE 1 /* free block marker */
24: #define LEASTFREE (2*sizeof(unsigned)) /* free nothing smaller */
25:
26: /* Macros. */
27: #define bumpp(p,n) (((char *)(p))+(n)) /* bump pointer p by n bytes */
28: #define isfree(x) (((unsigned)(x))&FREE)
29: #define mblockp(p) ((char *)(p)-sizeof(unsigned)) /* convert malloc ptr */
30: #define realsize(x) ((x) & ~FREE)
31: #define roundup(i,j) (((i) + (1 << (j)) - 1) & ~((1 << (j)) - 1))
32:
33: /* Memory block structure. */
34: typedef struct mblock {
35: unsigned blksize;
36: union {
37: char *next;
38: unsigned usera[];
39: } uval;
40: } MBLOCK;
41:
42: /* Globals common to malloc/realloc/memok/notmem. */
43: extern unsigned __a_count;
44: extern MBLOCK *__a_scanp, *__a_first;
45:
46: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.