summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--lib.c12
2 files changed, 20 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a2bf3525..0897bd32 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2015-02-12 Kaz Kylheku <kaz@kylheku.com>
+
+ * lib.c (lazy_appendv_func, lazy_appendv): Bugfix: append*
+ was silently ignoring lists after the first atom, instead of
+ throwing an error. Also, it was not detecting the case that
+ the last argument is a list which should just be returned,
+ and instead trying to find its tail in preparation for the
+ next call to lazy_appendv_func, the consequences being runaway
+ iteration over an infinite list.
+
2015-02-10 Kaz Kylheku <kaz@kylheku.com>
* eval.c (symacro_k, fun_k): New keyword variables.
diff --git a/lib.c b/lib.c
index 913d2b47..d4cc50cc 100644
--- a/lib.c
+++ b/lib.c
@@ -888,11 +888,15 @@ static val lazy_appendv_func(val env, val lcons)
rplaca(lcons, last);
- if (atom(nonempty)) {
+ if (nilp(lists)) {
rplacd(lcons, nonempty);
return nil;
}
+ if (atom(nonempty))
+ uw_throwf(error_s, lit("append*: cannot append to atom ~s"),
+ nonempty, nao);
+
rplacd(env, lists);
{
@@ -914,9 +918,13 @@ val lazy_appendv(val lists)
break;
}
- if (atom(nonempty))
+ if (nilp(lists))
return nonempty;
+ if (atom(nonempty))
+ uw_throwf(error_s, lit("append*: cannot append to atom ~s"),
+ nonempty, nao);
+
{
loc ptail = ltail(mkcloc(nonempty));
set(ptail, make_lazy_cons(func_f1(cons(car(deref(ptail)), lists),