projects
/
fw
/
altos
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
17fe6de
)
altos/scheme: Avoid crashing with non-list in length
author
Keith Packard
<keithp@keithp.com>
Sun, 10 Dec 2017 08:02:34 +0000
(
00:02
-0800)
committer
Keith Packard
<keithp@keithp.com>
Sun, 10 Dec 2017 08:02:34 +0000
(
00:02
-0800)
Use ao_scheme_cons_cdr to fetch the next list element as that returns
NULL for non-cons elements.
Signed-off-by: Keith Packard <keithp@keithp.com>
src/scheme/ao_scheme_cons.c
patch
|
blob
|
history
diff --git
a/src/scheme/ao_scheme_cons.c
b/src/scheme/ao_scheme_cons.c
index 03dad956d6561f59e31f4e79bc3004def0c3e2a9..21ee10cc668abb405ea52db60204053e5a6f01f1 100644
(file)
--- a/
src/scheme/ao_scheme_cons.c
+++ b/
src/scheme/ao_scheme_cons.c
@@
-195,7
+195,7
@@
ao_scheme_cons_length(struct ao_scheme_cons *cons)
int len = 0;
while (cons) {
len++;
- cons = ao_scheme_
poly_cons(cons->cdr
);
+ cons = ao_scheme_
cons_cdr(cons
);
}
return len;
}