mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-14 00:07:36 +02:00
Issue #310 - Fix type checking for member/assoc
This commit is contained in:
parent
12d6cbce5a
commit
c357663f0a
2 changed files with 9 additions and 2 deletions
|
@ -4,8 +4,13 @@
|
|||
|
||||
Features
|
||||
|
||||
- Speed up `case` expressions by using nested `if` expressions instead of the `memv` primitive to evaluate conditions with more than one constant. The nested expressions have better cache locality and also avoid any additional object allocation or initialization.
|
||||
- Allow passing the `'bin` symbol to `Cyc-installation-dir` to return the location of the installation directory for binaries.
|
||||
|
||||
Bug Fixes
|
||||
|
||||
- Prevent the possibility of a segmentation fault when passing am improper list to the `member` and `assoc` family of functions.
|
||||
|
||||
## 0.9.10 - March 5, 2019
|
||||
|
||||
Features
|
||||
|
|
|
@ -1231,8 +1231,8 @@ object Cyc_write_u8(void *data, object c, object port)
|
|||
/* Fast versions of member and assoc */
|
||||
object memberp(void *data, object x, list l)
|
||||
{
|
||||
Cyc_check_pair_or_null(data, l);
|
||||
for (; l != NULL; l = cdr(l)) {
|
||||
Cyc_check_pair_or_null(data, l);
|
||||
if (boolean_f != equalp(x, car(l)))
|
||||
return l;
|
||||
}
|
||||
|
@ -1241,8 +1241,8 @@ object memberp(void *data, object x, list l)
|
|||
|
||||
object memqp(void *data, object x, list l)
|
||||
{
|
||||
Cyc_check_pair_or_null(data, l);
|
||||
for (; l != NULL; l = cdr(l)) {
|
||||
Cyc_check_pair_or_null(data, l);
|
||||
if ((x == car(l)))
|
||||
return l;
|
||||
}
|
||||
|
@ -1254,6 +1254,7 @@ list assq(void *data, object x, list l)
|
|||
if ((l == NULL) || is_value_type(l) || type_of(l) != pair_tag)
|
||||
return boolean_f;
|
||||
for (; (l != NULL); l = cdr(l)) {
|
||||
Cyc_check_pair(data, l);
|
||||
list la = car(l);
|
||||
Cyc_check_pair(data, la);
|
||||
if ((x == car(la)))
|
||||
|
@ -1267,6 +1268,7 @@ list assoc(void *data, object x, list l)
|
|||
if ((l == NULL) || is_value_type(l) || type_of(l) != pair_tag)
|
||||
return boolean_f;
|
||||
for (; (l != NULL); l = cdr(l)) {
|
||||
Cyc_check_pair(data, l);
|
||||
list la = car(l);
|
||||
Cyc_check_pair(data, la);
|
||||
if (boolean_f != equalp(x, car(la)))
|
||||
|
|
Loading…
Add table
Reference in a new issue