/* -*-c-*-
*
- * $Id: mparena.h,v 1.1 1999/11/17 18:02:16 mdw Exp $
+ * $Id: mparena.h,v 1.2 1999/12/10 23:28:59 mdw Exp $
*
* Allocation and freeing of MP buffers
*
/*----- Revision history --------------------------------------------------*
*
* $Log: mparena.h,v $
+ * Revision 1.2 1999/12/10 23:28:59 mdw
+ * Memory allocation counting.
+ *
* Revision 1.1 1999/11/17 18:02:16 mdw
* New multiprecision integer arithmetic suite.
*
*/
-#ifndef MPARENA_H
-#define MPARENA_H
+#ifndef CATACOMB_MPARENA_H
+#define CATACOMB_MPARENA_H
#ifdef __cplusplus
extern "C" {
/*----- Header files ------------------------------------------------------*/
-#ifndef MPW_H
+#ifndef CATACOMB_MPW_H
# include "mpw.h"
#endif
typedef struct mparena {
mparena_node *root;
+ unsigned n;
struct mparena_ops *ops;
} mparena;
extern void mparena_create(mparena */*a*/);
-#define MPARENA_INIT { 0, &mparena_defaultops }
+#define MPARENA_INIT { 0, 0, &mparena_defaultops }
/* --- @mparena_setops@ --- *
*
extern void mparena_destroy(mparena */*a*/);
+/* --- @mparena_count@ --- *
+ *
+ * Arguments: @mparena *a@ = pointer to arena block
+ *
+ * Returns: Number of allocated blocks from this arena.
+ *
+ * Use: Reports the number of blocks allocated from the arena and not
+ * yet freed.
+ */
+
+extern unsigned mparena_count(mparena */*a*/);
+
/* --- @mpalloc@ --- *
*
* Arguments: @mparena *a@ = pointer to arena block
*
* Returns: ---
*
- * Use: Returns an MP vector to an arena. It doesn't have to be
- * returned to the arena from which it was allocated.
+ * Use: Returns an MP vector to an arena.
*/
extern void mpfree(mparena */*a*/, mpw */*v*/);