summaryrefslogtreecommitdiffstats
path: root/filter.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-02-22 01:21:46 -0800
committerKaz Kylheku <kaz@kylheku.com>2014-02-22 01:21:46 -0800
commitdebcf6f76029eec890192e8ee5b040b47120f91b (patch)
tree5b6b5d72e43c3c342bf4d8fecdcc2631ff06c492 /filter.c
parentaded325cb48f684b3a0849acde7ec31db48733ce (diff)
downloadtxr-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 'filter.c')
-rw-r--r--filter.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/filter.c b/filter.c
index 29911ba9..4d8f27f2 100644
--- a/filter.c
+++ b/filter.c
@@ -93,7 +93,7 @@ static void trie_compress(val *ptrie)
if (zerop(count)) {
set(*ptrie, value);
- } else if (eq(count, one) && nilp(value)) {
+ } else if (count == one && nilp(value)) {
val iter = hash_begin(trie);
val cell = hash_next(iter);
set(*ptrie, cons(car(cell), cdr(cell)));
@@ -131,7 +131,7 @@ val trie_lookup_feed_char(val node, val ch)
return gethash(node, ch);
if (functionp(node))
return funcall1(node, ch);
- if (consp(node) && eq(ch,car(node)))
+ if (consp(node) && ch == car(node))
return cdr(node);
return nil;
}
@@ -246,9 +246,9 @@ val filter_string_tree(val filter, val obj)
{
val type = typeof(filter);
- if (eq(type, null_s))
+ if (type == null_s)
return obj;
- if (eq(type, hash_s) || eq(type, cons_s))
+ if (type == hash_s || type == cons_s)
return trie_filter_string(filter, obj);
else if (type == fun_s)
return funcall1(filter, obj);
@@ -549,7 +549,7 @@ static val html_hex_continue(val hexlist, val ch)
{
if (iswxdigit(c_chr(ch))) {
return func_f1(cons(ch, hexlist), html_hex_continue);
- } if (eq(ch, chr(';'))) {
+ } if (ch == chr(';')) {
wchar_t out[2] = { 0 };
val iter;
@@ -573,7 +573,7 @@ static val html_dec_continue(val declist, val ch)
{
if (iswdigit(c_chr(ch))) {
return func_f1(cons(ch, declist), html_dec_continue);
- } if (eq(ch, chr(';'))) {
+ } if (ch == chr(';')) {
wchar_t out[2] = { 0 };
val iter;
@@ -592,7 +592,7 @@ static val html_dec_continue(val declist, val ch)
static val html_numeric_handler(val ch)
{
- if (eq(ch, chr('x')))
+ if (ch == chr('x'))
return func_f1(nil, html_hex_continue);
if (!iswdigit(c_chr(ch)))
return nil;