.nf
.B "#include <mLib/arena.h>"
+.B "typedef struct {"
+.B "\h'4n'const struct arena_ops *ops";
+.B "} arena;"
+
+.B "typedef struct {"
+.BI "\h'4n'void *(*alloc)(arena *" a ", size_t " sz );
+.BI "\h'4n'void *(*realloc)(arena *" a ", void *" p ", size_t " sz ", size_t " osz );
+.BI "\h'4n'void *(*free)(arena *" a ", void *" p );
+.BI "\h'4n'void *(*purge)(arena *" a );
+.B "} arena_ops;"
+
.BI "arena *arena_global;"
.BI "arena arena_stdlib;"
table contains function pointers which are called to perform various
memory allocation tasks:
.TP
-.BI "void *(*" alloc ")(arena *" a ", size_t " sz );
+.BI "void *(*alloc)(arena *" a ", size_t " sz );
Allocates a block of memory, of at least
.I sz
bytes in size, appropriately aligned, and returns its address.
.nf
.TP
-.BI "void *(*" realloc ")(arena *" a ", void *" p ", size_t " sz ", size_t " osz );
+.BI "void *(*realloc)(arena *" a ", void *" p ", size_t " sz ", size_t " osz );
.fi
Resizes the block pointed to by
.IR p ,
here, to fake resizing by allocating, copying and freeing, if your arena
doesn't make doing something more efficient easy.
.TP
-.BI "void (*" free ")(arena *" a ", void *" p );
+.BI "void (*free)(arena *" a ", void *" p );
Frees the block pointed to by
.IR p .
.TP
-.BI "void (*" purge ")(arena *" a );
+.BI "void (*purge)(arena *" a );
Frees all blocks in the arena. Used when the arena is being destroyed.
.PP
The behaviour of the