The `llgen' function just tries again if `pgen' reports an abort. This
is entirely contrary to the intend of the `PGEN_ABORT' protocol, so I've
no idea why I thought this was a good idea.
Instead, leave the prime slot null (because adding a return code to the
`pgen' callback breaks the API), and arrange for the caller to notice
and clean up. This is annoyingly because there may be an `mpmul' in
progress.
p = mprand(l->newp, pl, l->r, 1);
pf.step = 2;
p = pgen(l->u.s.name, p, p, l->iev, l->iec, 0, pgen_filter, &pf,
rabin_iters(pl), pgen_test, &r);
p = mprand(l->newp, pl, l->r, 1);
pf.step = 2;
p = pgen(l->u.s.name, p, p, l->iev, l->iec, 0, pgen_filter, &pf,
rabin_iters(pl), pgen_test, &r);
static int next(int rq, pgen_event *ev, limlee_stepctx *l)
{
dstr d = DSTR_INIT;
static int next(int rq, pgen_event *ev, limlee_stepctx *l)
{
dstr d = DSTR_INIT;
int rc;
int dist;
unsigned nb;
int rc;
int dist;
unsigned nb;
dstr_putf(&d, "%s_%lu", ev->name, l->seq++);
l->u.s.name = d.buf;
l->pops->pgen(&l->v[i], l->ql, l);
dstr_putf(&d, "%s_%lu", ev->name, l->seq++);
l->u.s.name = d.buf;
l->pops->pgen(&l->v[i], l->ql, l);
+ if (!l->v[i].p)
+ { mp_drop(mpmul_done(&mm)); rc = PGEN_ABORT; goto end; }
}
mpmul_add(&mm, l->v[i].p);
}
}
mpmul_add(&mm, l->v[i].p);
}
dstr_putf(&d, "%s*_%lu", ev->name, l->seq++);
l->u.s.name = d.buf;
l->pops->pgen(&l->qq, l->pl - mp_bits(p), l);
dstr_putf(&d, "%s*_%lu", ev->name, l->seq++);
l->u.s.name = d.buf;
l->pops->pgen(&l->qq, l->pl - mp_bits(p), l);
+ if (!l->qq.p) { MP_DROP(p); p = 0; rc = PGEN_ABORT; break; }
l->u.s.steps = l->u.s.disp = 0;
p = mp_mul(p, p, l->qq.p);
}
l->u.s.steps = l->u.s.disp = 0;
p = mp_mul(p, p, l->qq.p);
}
if ((rc = pfilt_smallfactor(p)) != PGEN_FAIL)
break;
if ((rc = pfilt_smallfactor(p)) != PGEN_FAIL)
break;
ev->m = p;
DDESTROY(&d);
return (rc);
ev->m = p;
DDESTROY(&d);
return (rc);