6 #define ALIGNMENT 16 /* XXX: assuming that this alignment is enough */
7 #define SPACE 4096 /* must be multiple of ALIGNMENT */
9 typedef union { char irrelevant[ALIGNMENT]; double d; } aligned;
10 static aligned realspace[SPACE / ALIGNMENT];
11 #define space ((char *) realspace)
12 static unsigned int avail = SPACE; /* multiple of ALIGNMENT; 0<=avail<=SPACE */
14 /*@null@*//*@out@*/char *alloc(n)
18 n = ALIGNMENT + n - (n & (ALIGNMENT - 1)); /* XXX: could overflow */
19 if (n <= avail) { avail -= n; return space + avail; }
21 if (!x) errno = error_nomem;
29 if (x < space + SPACE)
30 return; /* XXX: assuming that pointers are flat */