Expunge revision histories in files.
[u/mdw/catacomb] / mparena.c
index 95f88d5..49315f5 100644 (file)
--- a/mparena.c
+++ b/mparena.c
@@ -1,6 +1,6 @@
 /* -*-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>
@@ -214,6 +194,8 @@ unsigned mparena_count(mparena *a)
 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);
@@ -314,6 +296,8 @@ again:
 
 void mpfree(mparena *a, mpw *v)
 {
+  if (!v) return;
+  a->n--;
   A_FREE(a->a, v);
 }