From aded325cb48f684b3a0849acde7ec31db48733ce Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 22 Feb 2014 00:58:18 -0800 Subject: The C function nullp is being renamed to null, and the rarely used global variable null which holds a symbol becomes null_s. A new macro called nilp is added that more efficiently checks whether an object is nil, producing a C boolean value rather than t or nil. Most of the uses of nullp in the codebase just become the more streamlined nilp. * debug.c (show_bindings): nullp to nilp * eval.c (lookup_var, lookup_var_l, lookup_fun, lookup_sym_lisp1, do_eval, expand_qquote, expand_quasi, expand_op): nullp to nilp. (op_modplace): nullp to null. (eval_init): Update registration of null and not from C function nullp to null. * filter.c (trie_compress, html_hex_continue): nullp to nil. (filter_string_tree): null to null_s. * hash.c (hash_next): nullp to nilp. * lib.c (null): Variable renamed to null_s. (code2type): null to null_s. (lazy_flatten_scan, chainv, lazy_str, lazy_str_force_upto, obj_print, obj_pprint): nullp to nilp. (obj_init): null to null_s; nullp to null. * lib.h (null): declaration changed to null_s. (nullp): Inline function renamed to null. (nilp): New macro. * match.c (do_match_line): nullp to nilp. * rand.c (make_random_state): Likewise. * regex.c (compile_regex): Likewise. --- lib.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib.h') diff --git a/lib.h b/lib.h index 0c5e2445..d817857d 100644 --- a/lib.h +++ b/lib.h @@ -315,7 +315,8 @@ INLINE val chr(wchar_t ch) #define lit(strlit) lit_noex(strlit) extern val keyword_package, system_package, user_package; -extern val null, t, cons_s, str_s, chr_s, fixnum_s, sym_s, pkg_s, fun_s, vec_s; +extern val null_s, t, cons_s, str_s, chr_s, fixnum_sl; +extern val sym_s, pkg_s, fun_s, vec_s; extern val stream_s, hash_s, hash_iter_s, lcons_s, lstr_s, cobj_s, cptr_s; extern val env_s, bignum_s, float_s; extern val var_s, expr_s, regex_s, chset_s, set_s, cset_s, wild_s, oneplus_s; @@ -718,7 +719,9 @@ void breakpt(void); INLINE val eq(val a, val b) { return a == b ? t : nil; } -INLINE val nullp(val v) { return v ? nil : t; } +INLINE val null(val v) { return v ? nil : t; } + +#define nilp(o) ((o) == nil) #define nao ((obj_t *) (1 << TAG_SHIFT)) /* "not an object" sentinel value. */ -- cgit v1.2.3