Track suggested destination changes.
authormdw <mdw>
Fri, 10 Dec 1999 23:28:35 +0000 (23:28 +0000)
committermdw <mdw>
Fri, 10 Dec 1999 23:28:35 +0000 (23:28 +0000)
pgen.c

diff --git a/pgen.c b/pgen.c
index a57c30a..e9a5e75 100644 (file)
--- a/pgen.c
+++ b/pgen.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: pgen.c,v 1.2 1999/11/20 22:23:05 mdw Exp $
+ * $Id: pgen.c,v 1.3 1999/12/10 23:28:35 mdw Exp $
  *
  * Finding and testing prime numbers
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: pgen.c,v $
+ * Revision 1.3  1999/12/10 23:28:35  mdw
+ * Track suggested destination changes.
+ *
  * Revision 1.2  1999/11/20 22:23:05  mdw
  * Add multiply-and-add function for Diffie-Hellman safe prime generation.
  *
@@ -129,7 +132,8 @@ int pgen_step(pgen *p, mpw step)
 
   /* --- Add the step on to the number --- */
 
-  p->m = mp_modify(p->m, MP_LEN(p->m) + 1);
+  p->m = mp_split(p->m);
+  mp_ensure(p->m, MP_LEN(p->m) + 1);
   mpx_uaddn(p->m->v, p->m->vl, step);
   mp_shrink(p->m);
 
@@ -323,6 +327,7 @@ static int verify(dstr *v)
   mp_drop(m);
   mp_drop(r);
   pgen_destroy(&p);
+  assert(mparena_count(MPARENA_GLOBAL) == 0);
   return (ok);
 }