X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/blobdiff_plain/cededfbe1efb12e68c1defe008f1d69d97f4cbe3..9b5ac6ff2ef1b71e7ec53c756cad37b1844b9d1e:/man/arena.3 diff --git a/man/arena.3 b/man/arena.3 index d7631c2..2a36820 100644 --- a/man/arena.3 +++ b/man/arena.3 @@ -1,5 +1,5 @@ .\" -*-nroff-*- -.TH arena 3 "3 June 2000" mLib +.TH arena 3 "3 June 2000" "Straylight/Edgeware" "mLib utilities library" .SH "NAME" arena \- control of memory allocation .\" @arena_global @@ -18,14 +18,15 @@ arena \- control of memory allocation .BI "arena *arena_global;" .BI "arena arena_stdlib;" -.BI "void *arena_fakerealloc(arena *" a ", void *" p ", size_t " sz ); +.BI "void *arena_fakerealloc(arena *" a ", void *" p , +.BI " size_t " sz ", size_t " osz ); .BI "void *a_alloc(arena *" a ", size_t " sz ); -.BI "void *a_realloc(arena *" a ", void *" p ", size_t " sz ); +.BI "void *a_realloc(arena *" a ", void *" p ", size_t " sz ", size_t " osz ); .BI "void a_free(arena *" a ); .BI "void *A_ALLOC(arena *" a ", size_t " sz ); -.BI "void *A_REALLOC(arena *" a ", void *" p ", size_t " sz ); +.BI "void *A_REALLOC(arena *" a ", void *" p ", size_t " sz ", size_t " osz ); .BI "void A_FREE(arena *" a ); .fi .SH "DESCRIPTION" @@ -60,6 +61,14 @@ function-call equivalents with lower-case names too. For a more convenient interface to memory allocation, see .BR alloc (3). .PP +.B Note: +The +.B realloc +function has an extra argument +.I osz +specifying the old size of the block. This is for the benefit of arena +handlers which can't easily find the old block's size. +.PP .SS "Defining new arenas" An .B arena @@ -81,10 +90,15 @@ memory allocation tasks: 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 ); +.BI "void *(*" realloc ")(arena *" a ", void *" p ", size_t " sz ", size_t " osz ); +.fi Resizes the block pointed to by .IR p , +with +.I osz +interesting bytes in it, so that it is at least .I sz bytes long. You can use @@ -110,4 +124,4 @@ specified by the ANSI C standard. .BR alloc (3), .BR mLib (3). .SH AUTHOR -Mark Wooding, +Mark Wooding,