diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-01-01 19:56:11 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-01-01 19:56:11 -0800 |
commit | 6ac45e04ea817dcd6df3a749f523ed1b96ec0118 (patch) | |
tree | bfd8211f0d14cbc1978b231b3a2504209f72aa24 /lib.c | |
parent | 79a90b980192de7410a7e688e1c831f7878f8714 (diff) | |
download | txr-6ac45e04ea817dcd6df3a749f523ed1b96ec0118.tar.gz txr-6ac45e04ea817dcd6df3a749f523ed1b96ec0118.tar.bz2 txr-6ac45e04ea817dcd6df3a749f523ed1b96ec0118.zip |
Use rplaca and rplacd instead of set over car_l/cdr_l.
This reduces the proliferation of car_l and cdr_l.
With this change, nreverse should work on chains of
objects that implement rplacd.
* combi.c (comb_gen_fun_common, rcomb_gen_fun_common): Use
rplaca.
* eval.c (mappendv, mapdov): Likewise
* hash.c (hash_equal_op): Likewise.
* lib.c (nreverse, acons_new, aconsql_new, sort_list): Use
rplaca and rplacd.
* match.c (dest_set, v_gather, v_collect, v_flatten, v_cat,
v_output, v_filter): Likewise
* parser.c (ensure_parser): Use sys_rplacd.
* unwind.c (uw_register_subtype): Use rplacd.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1104,7 +1104,7 @@ val nreverse(val in) while (in) { val temp = cdr(in); - set(cdr_l(in), rev); + rplacd(in, rev); rev = in; in = temp; } @@ -7803,7 +7803,7 @@ val acons_new(val key, val value, val list) val existing = assoc(key, list); if (existing) { - set(cdr_l(existing), value); + rplacd(existing, value); return list; } else { return cons(cons(key, value), list); @@ -7832,7 +7832,7 @@ val aconsql_new(val key, val value, val list) val existing = assql(key, list); if (existing) { - set(cdr_l(existing), value); + rplacd(existing, value); return list; } else { return cons(cons(key, value), list); @@ -8207,8 +8207,8 @@ static val sort_list(val list, val lessfun, val keyfun) may contain mixtures of old and new objects, and so we could be reversing a newer->older pointer relationship. */ - set(cdr_l(cons2), list); - deref(cdr_l(list)) = nil; + rplacd(cons2, list); + rplacd(list, nil); return cons2; } else { return list; @@ -8224,7 +8224,7 @@ static val sort_list(val list, val lessfun, val keyfun) ; /* empty */ list2 = cdr(bisect); - deref(cdr_l(bisect)) = nil; + rplacd(bisect, nil); return merge(sort_list(list, lessfun, keyfun), sort_list(list2, lessfun, keyfun), |