/* -*-c-*-
*
- * $Id: mparena.c,v 1.5 2000/06/17 11:35:48 mdw Exp $
+ * $Id: mparena.c,v 1.7 2004/04/08 01:36:15 mdw Exp $
*
* Allocation and freeing of MP buffers
*
* MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: mparena.c,v $
- * Revision 1.5 2000/06/17 11:35:48 mdw
- * Overhaul to use mLib's arena system underneath.
- *
- * Revision 1.4 1999/12/10 23:28:52 mdw
- * Memory allocation counting.
- *
- * Revision 1.3 1999/11/22 13:58:00 mdw
- * Document the tweakables.
- *
- * Revision 1.2 1999/11/21 22:14:19 mdw
- * Fix bug. Improve diagnostic capabilities.
- *
- * Revision 1.1 1999/11/17 18:02:16 mdw
- * New multiprecision integer arithmetic suite.
- *
- */
-
/*----- Header files ------------------------------------------------------*/
#include <stdio.h>
mpw *mpalloc(mparena *a, size_t sz)
{
mpw *v;
+ if (!sz) return (0);
+ a->n++;
v = A_ALLOC(a->a, MPWS(sz));
if (!v)
THROW(EXC_NOMEM);
void mpfree(mparena *a, mpw *v)
{
+ if (!v) return;
+ a->n--;
A_FREE(a->a, v);
}