/* -*-c-*-
*
- * $Id: mp-mem.c,v 1.1 1999/11/17 18:02:16 mdw Exp $
+ * $Id: mp-mem.c,v 1.2 1999/12/10 23:19:02 mdw Exp $
*
* Memory management for multiprecision numbers
*
/*----- Revision history --------------------------------------------------*
*
* $Log: mp-mem.c,v $
+ * Revision 1.2 1999/12/10 23:19:02 mdw
+ * Improve error-checking.
+ *
* Revision 1.1 1999/11/17 18:02:16 mdw
* New multiprecision integer arithmetic suite.
*
void mp_destroy(mp *m)
{
- if (m->f & MP_CONST)
- return;
+ assert(((void)"Destroying a free integer", !(m->f & MP_DESTROYED)));
+ assert(((void)"Attempted to destroy a constant", !(m->f & MP_CONST)));
if (m->f & MP_BURN)
memset(m->v, 0, MPWS(m->sz));
MP_FREE(m->v);
+ m->f |= MP_DESTROYED;
DESTROY(m);
}