~mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
progs/perftest.c: Use from Glibc syscall numbers.
[catacomb]
/
math
/
limlee.c
diff --git
a/math/limlee.c
b/math/limlee.c
index
28975d0
..
c99ba7b
100644
(file)
--- a/
math/limlee.c
+++ b/
math/limlee.c
@@
-390,6
+390,8
@@
mp *limlee(const char *name, mp *d, mp *newp,
{
limlee_stepctx l;
rabin rr;
{
limlee_stepctx l;
rabin rr;
+ mp **v;
+ size_t i;
l.f = 0; if (f) l.f |= LIMLEE_KEEPFACTORS;
l.newp = newp;
l.f = 0; if (f) l.f |= LIMLEE_KEEPFACTORS;
l.newp = newp;
@@
-402,15
+404,18
@@
mp *limlee(const char *name, mp *d, mp *newp,
d = pgen(name, d, 0, oev, oec, on, limlee_step, &l,
rabin_iters(pl), pgen_test, &rr);
d = pgen(name, d, 0, oev, oec, on, limlee_step, &l,
rabin_iters(pl), pgen_test, &rr);
- if (d && f) {
- mp **v;
- size_t i;
- v = xmalloc(l.nf * sizeof(mp *));
- for (i = 0; i < l.nf; i++)
- v[i] = l.v[i].p;
- xfree(l.v);
- *f = v;
- *nf = l.nf;
+ if (f) {
+ if (!d) {
+ for (i = 0; i < l.nf; i++)
+ if (l.v[i].p) llfree(&l.v[i], &l);
+ } else {
+ v = xmalloc(l.nf * sizeof(mp *));
+ for (i = 0; i < l.nf; i++)
+ v[i] = l.v[i].p;
+ xfree(l.v);
+ *f = v;
+ *nf = l.nf;
+ }
}
return (d);
}
return (d);