X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/blobdiff_plain/0fd574c3198e0a08b7b27972f7931d0c7deb19fb..3980d2f1149bea533dc64545d657a584e4a2d7b7:/alloc.h diff --git a/alloc.h b/alloc.h index edf555a..feed0bf 100644 --- a/alloc.h +++ b/alloc.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: alloc.h,v 1.5 2000/06/17 10:35:51 mdw Exp $ + * $Id: alloc.h,v 1.6 2000/07/16 12:29:16 mdw Exp $ * * Memory allocation functions * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: alloc.h,v $ + * Revision 1.6 2000/07/16 12:29:16 mdw + * Change to arena `realloc' interface, to fix a design bug. + * * Revision 1.5 2000/06/17 10:35:51 mdw * Major overhaul for arena support. * @@ -96,6 +99,7 @@ extern char *x_strdup(arena */*a*/, const char */*s*/); * Arguments: @arena *a@ = pointer to underlying arena * @void *p@ = pointer to a block of memory * @size_t sz@ = new size desired for the block + * @size_t osz@ = size of the old block * * Returns: Pointer to the resized memory block (which is almost * certainly not in the same place any more). @@ -104,7 +108,8 @@ extern char *x_strdup(arena */*a*/, const char */*s*/); * exception @EXC_NOMEM@ is thrown. */ -extern void *x_realloc(arena */*a*/, void */*p*/, size_t /*sz*/); +extern void *x_realloc(arena */*a*/, void */*p*/, + size_t /*sz*/, size_t /*osz*/); /* --- @x_free@ --- * * @@ -152,6 +157,7 @@ extern char *xstrdup(const char */*s*/); * * Arguments: @void *p@ = pointer to a block of memory * @size_t sz@ = new size desired for the block + * @size_t osz@ = size of the old block * * Returns: Pointer to the resized memory block (which is almost * certainly not in the same place any more). @@ -160,8 +166,8 @@ extern char *xstrdup(const char */*s*/); * exception @EXC_NOMEM@ is thrown. */ -extern void *xrealloc(void */*p*/, size_t /*sz*/); -#define xrealloc(p, sz) x_realloc(arena_global, (p), (sz)) +extern void *xrealloc(void */*p*/, size_t /*sz*/, size_t /*osz*/); +#define xrealloc(p, sz, osz) x_realloc(arena_global, (p), (sz), (osz)) /* --- @xfree@ --- * *