X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/d3409d5ecf2492cff862616de72a580d1a8e8dc0..2bdb833f485d3c985a0f930865452fcaafdf95dd:/mp-mem.c diff --git a/mp-mem.c b/mp-mem.c index 2f75365..833874d 100644 --- a/mp-mem.c +++ b/mp-mem.c @@ -1,6 +1,6 @@ /* -*-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 * @@ -30,6 +30,9 @@ /*----- 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. * @@ -99,11 +102,12 @@ void mp_build(mp *m, mpw *v, mpw *vl) 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); }