X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/b817bfc642225b8c3c0b6a7e42d1fb949b61a606..f0c52873e4c1e3a16bb2d5a086df2526f698e4ac:/mp-mem.c diff --git a/mp-mem.c b/mp-mem.c index 4d9ee48..fcb6c4d 100644 --- a/mp-mem.c +++ b/mp-mem.c @@ -1,13 +1,13 @@ /* -*-c-*- * - * $Id: mp-mem.c,v 1.7 2004/04/08 01:36:15 mdw Exp $ + * $Id: mp-mem.c,v 1.8 2004/04/08 16:17:32 mdw Exp $ * * Memory management for multiprecision numbers * * (c) 1999 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Catacomb. * @@ -15,12 +15,12 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * Catacomb is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with Catacomb; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, @@ -98,7 +98,7 @@ mp *mp_create(size_t sz) mp *mp_createsecure(size_t sz) { - mp *m = CREATE(mp); + mp *m = CREATE(mp); m->v = mpalloc(MPARENA_SECURE, sz); m->vl = m->v + sz; m->sz = sz; @@ -127,6 +127,7 @@ void mp_build(mp *m, mpw *v, mpw *vl) m->v = v; m->vl = vl; m->sz = vl - v; + m->a = MPARENA_GLOBAL; m->f = MP_CONST; m->ref = 1; } @@ -197,7 +198,7 @@ mp *mp_split(mp *m) { MP_SPLIT(m); return (m); } * Returns: --- * * Use: Changes an integer's size. The length and value are not - * changed. It is an error to + * changed. It is an error to */ void mp_resize(mp *m, size_t sz) { MP_RESIZE(m, sz); } @@ -265,7 +266,7 @@ mp *mp_dest(mp *m, size_t sz, unsigned f) /* --- Otherwise check whether the destination is suitable --- */ if (m->ref > 1 || (m->f & MP_CONST) || - sz > m->sz || !((f & ~m->f) & MP_BURN)) { + sz > m->sz || ((f & ~m->f) & MP_BURN)) { /* --- No -- allocate a new buffer --- * * @@ -273,7 +274,7 @@ mp *mp_dest(mp *m, size_t sz, unsigned f) * buffer, or (b) the old buffer is secure and I'm not allowed to * discard the old contents. */ - + mparena *a; mpw *v;