Expunge revision histories in files.
[u/mdw/catacomb] / limlee.c
index afc1e7d..5708156 100644 (file)
--- a/limlee.c
+++ b/limlee.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: limlee.c,v 1.7 2001/01/25 21:40:44 mdw Exp $
+ * $Id: limlee.c,v 1.9 2004/04/08 01:36:15 mdw Exp $
  *
  * Generate Lim-Lee primes
  *
  * MA 02111-1307, USA.
  */
 
-/*----- Revision history --------------------------------------------------* 
- *
- * $Log: limlee.c,v $
- * Revision 1.7  2001/01/25 21:40:44  mdw
- * Remove dead code now that the new stepper structure is trustworthy.
- *
- * Revision 1.6  2001/01/25 21:16:20  mdw
- * Boring cosmetic stuff.
- *
- * Revision 1.5  2000/08/18 19:16:51  mdw
- * New stepper interface for constructing Lim-Lee primes.
- *
- * Revision 1.4  2000/08/15 21:45:05  mdw
- * Use the new trial division equipment in pfilt.  This gives a 10%
- * performance improvement in dsa-gen.t.
- *
- * Revision 1.3  2000/07/29 09:58:32  mdw
- * (limlee): Bug fix.  Old versions didn't set the filter step if @ql@ was
- * an exact divisor of @pl@.
- *
- * Revision 1.2  2000/07/26 18:00:00  mdw
- * No footer line!
- *
- * Revision 1.1  2000/07/09 21:30:58  mdw
- * Lim-Lee prime generation.
- *
- */
-
 /*----- Header files ------------------------------------------------------*/
 
 #include <mLib/alloc.h>
@@ -156,8 +128,7 @@ again:
 
 static void llfree(limlee_factor *f, limlee_stepctx *l)
 {
-  if (f->p)
-    mp_drop(f->p);
+  mp_drop(f->p);
 }
 
 static const limlee_primeops primeops_simple = { llgen, llfree };
@@ -211,7 +182,6 @@ static int init(pgen_event *ev, limlee_stepctx *l)
   /* --- Other bits of initialization --- */
 
   l->seq = 0;
-  l->r = ev->r;
   dstr_create(&l->d);
   if (!l->pops) {
     l->pops = &primeops_simple;
@@ -246,9 +216,7 @@ static int next(int rq, pgen_event *ev, limlee_stepctx *l)
   mp *p;
   int rc;
 
-  if (ev->m)
-    mp_drop(ev->m);
-  l->r = ev->r;
+  mp_drop(ev->m);
 
   for (;;) {
     size_t i;
@@ -408,11 +376,12 @@ mp *limlee(const char *name, mp *d, mp *newp,
   l.pops = 0;
   l.iev = iev;
   l.iec = iec;
+  l.r = r;
 
   d = pgen(name, d, 0, oev, oec, on, limlee_step, &l,
           rabin_iters(pl), pgen_test, &rr);
 
-  if (f) {
+  if (d && f) {
     mp **v;
     size_t i;
     v = xmalloc(l.nf * sizeof(mp *));