diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-02-22 01:21:46 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-02-22 01:21:46 -0800 |
commit | debcf6f76029eec890192e8ee5b040b47120f91b (patch) | |
tree | 5b6b5d72e43c3c342bf4d8fecdcc2631ff06c492 /lib.c | |
parent | aded325cb48f684b3a0849acde7ec31db48733ce (diff) | |
download | txr-debcf6f76029eec890192e8ee5b040b47120f91b.tar.gz txr-debcf6f76029eec890192e8ee5b040b47120f91b.tar.bz2 txr-debcf6f76029eec890192e8ee5b040b47120f91b.zip |
Replacing uses of the eq function which are used only as C booleans,
with just using the == operator.
Removing cobj_equal_op since it's indistinguishable from eq.
Streamlining missingp and null_or_missing_p.
* eval.c (transform_op): eq to ==.
(c_var_ops): cobj_equal_op to eq.
* filter.c (trie_compress, trie_lookup_feed_char, filter_string_tree,
html_hex_continue, html_dec_continue): eq to ==.
* hash.c (hash_iter_ops): cobj_equal to eq.
* lib.c (countq, getplist, getplist_f, search_str_tree,
posq): eq to ==.
(cobj_equal_op): Function removed.
* lib.h (cobj_equal_op): Declaration removed.
(missingp): Becomes a simple macro that yields a C boolean instead
of t/nil val, because it's only used that way.
(null_or_missing_p): Becomes inline function returning int.
* match.c (v_output): eq to ==.
* rand.c (random_state_ops): cobj_equal_op to eq.
* regex.c (char_set_obj_ops, regex_obj_ops): cobj_equal_op to eq.
(reg_derivative): Silly if3 expression replaced by null.
(regexp): Redundant if2 expression wrapped around eq removed.
* stream.c (null_ops, stdio_ops, tail_ops, pipe_ops, string_in_ops,
byte_in_ops, string_out_ops, strlist_out_ops, dir_ops,
cat_stream_ops): cobj_equal_op to eq.
* syslog.c (syslog_strm_ops): cobj_equal_op to eq.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -1014,7 +1014,7 @@ val countq(val obj, val list) val count = zero; for (; list; list = cdr(list)) - if (eq(car(list), obj)) + if (car(list) == obj) count = plus(count, one); return count; @@ -1276,11 +1276,6 @@ val equal(val left, val right) internal_error("unhandled case in equal function"); } -val cobj_equal_op(val left, val right) -{ - return eq(left, right); -} - static mem_t *malloc_low_bound, *malloc_high_bound; mem_t *chk_malloc(size_t size) @@ -1444,7 +1439,7 @@ val getplist(val list, val key) { for (; list; list = cdr(cdr(list))) { val ind = first(list); - if (eq(ind, key)) + if (ind == key) return second(list); } @@ -1455,7 +1450,7 @@ val getplist_f(val list, val key, val *found) { for (; list; list = cdr(cdr(list))) { val ind = first(list); - if (eq(ind, key)) { + if (ind == key) { *found = t; return second(list); } @@ -1979,7 +1974,7 @@ val search_str_tree(val haystack, val tree, val start_num, val from_end) val result = search_str_tree(haystack, car(tree), start_num, from_end); if (result) { cons_bind (pos, len, result); - if (!it || lt(pos, minpos) || (eq(pos, minpos) && gt(len, maxlen))) { + if (!it || lt(pos, minpos) || (pos == minpos && gt(len, maxlen))) { minpos = pos; maxlen = len; it = result; @@ -4815,7 +4810,7 @@ val posq(val obj, val list) val pos = zero; for (; list; list = cdr(list), pos = plus(pos, one)) - if (eq(car(list), obj)) + if (car(list) == obj) return pos; return nil; |