mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-08 21:47:33 +02:00
Issue #116 - Type check chars sent to list->string
This commit is contained in:
parent
62c0358605
commit
9bbb7c7dd6
2 changed files with 5 additions and 1 deletions
|
@ -14,7 +14,8 @@ Bug Fixes
|
||||||
- Improved macro hygiene support to properly rename temporary variables in the `let-values` macro.
|
- Improved macro hygiene support to properly rename temporary variables in the `let-values` macro.
|
||||||
- Improve output of `error` by outputting objects as they are represented in memory by using `write`.
|
- Improve output of `error` by outputting objects as they are represented in memory by using `write`.
|
||||||
- Check for duplicate lambda parameters during compilation.
|
- Check for duplicate lambda parameters during compilation.
|
||||||
- Fixd an error that was being raised when calling `(random-source-randomize! default-random-source)`.
|
- Fixed an error that was being raised when calling `(random-source-randomize! default-random-source)`.
|
||||||
|
- Raise an error if `list->string` encounters a list element that is not a character.
|
||||||
|
|
||||||
# 0.2 - September 7, 2016
|
# 0.2 - September 7, 2016
|
||||||
|
|
||||||
|
|
|
@ -1491,6 +1491,9 @@ object Cyc_list2string(void *data, object cont, object lst)
|
||||||
len = Cyc_length(data, lst); // Inefficient, walks whole list
|
len = Cyc_length(data, lst); // Inefficient, walks whole list
|
||||||
buf = alloca(sizeof(char) * (obj_obj2int(len) + 1));
|
buf = alloca(sizeof(char) * (obj_obj2int(len) + 1));
|
||||||
while ((lst != NULL)) {
|
while ((lst != NULL)) {
|
||||||
|
if (!obj_is_char(car(lst))) {
|
||||||
|
Cyc_rt_raise2(data, "Expected character but received", car(lst));
|
||||||
|
}
|
||||||
buf[i++] = obj_obj2char(car(lst));
|
buf[i++] = obj_obj2char(car(lst));
|
||||||
lst = cdr(lst);
|
lst = cdr(lst);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue