diff options
author | Keith Packard <keithp@keithp.com> | 2017-12-03 19:49:20 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-12-03 19:49:20 -0800 |
commit | 32ab76c3049b913283caafbaef873754d76dc9d4 (patch) | |
tree | 427cdc7b1bb66891bcc5514af4a7ba0ca189a4c1 /src/lisp/ao_lisp_cons.c | |
parent | ed6967cef5d82baacafe1c23229f44d58c838326 (diff) |
altos/lisp: Check only cdr base type when moving cons cells
The cdr may have moved, so we can't look at the target object
type. Fortunately, the base type encoded in the reference itself is
sufficient to check for a non-cons cdr.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/lisp/ao_lisp_cons.c')
-rw-r--r-- | src/lisp/ao_lisp_cons.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lisp/ao_lisp_cons.c b/src/lisp/ao_lisp_cons.c index 06e9d361..d3b97383 100644 --- a/src/lisp/ao_lisp_cons.c +++ b/src/lisp/ao_lisp_cons.c @@ -58,8 +58,8 @@ static void cons_move(void *addr) cdr = cons->cdr; if (!cdr) break; - if (ao_lisp_poly_type(cdr) != AO_LISP_CONS) { - (void) ao_lisp_poly_move(&cons->cdr, 1); + if (ao_lisp_poly_base_type(cdr) != AO_LISP_CONS) { + (void) ao_lisp_poly_move(&cons->cdr, 0); break; } c = ao_lisp_poly_cons(cdr); @@ -95,8 +95,8 @@ ao_lisp_cons_cons(ao_poly car, ao_poly cdr) ao_lisp_poly_stash(0, car); ao_lisp_poly_stash(1, cdr); cons = ao_lisp_alloc(sizeof (struct ao_lisp_cons)); - car = ao_lisp_poly_fetch(0); cdr = ao_lisp_poly_fetch(1); + car = ao_lisp_poly_fetch(0); if (!cons) return NULL; } |