#include "arena.h" #include "minilib.h" #include "io.h" static char p[ARENA_SIZE]; static char *ptr = p; void *allocate( int size ) { char *m; if( ptr - p + size < ARENA_SIZE ) { m = ptr; ptr = ptr + size; return m; } print( "OUT OF MEMORY" ); halt( ); } void deallocate( void **p ) { if( *p == 0 ) { print( "DEALLOCATING ALREADY FREED POINTER" ); halt( ); } *p = 0; }