diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-02-05 14:25:59 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-02-05 14:25:59 -0800 |
commit | 03be4ba79f2fa68d966c81be4f32b36f9fe09813 (patch) | |
tree | 1532b50183d934167344604358b7583448f2043b | |
parent | 1be4447a30aa5787b99ce2dec5c6977322aefebe (diff) | |
download | txr-03be4ba79f2fa68d966c81be4f32b36f9fe09813.tar.gz txr-03be4ba79f2fa68d966c81be4f32b36f9fe09813.tar.bz2 txr-03be4ba79f2fa68d966c81be4f32b36f9fe09813.zip |
Use null_string throughout code base.
* eval.c (load): Use null_string instead of lit("").
* lib.c (obj_init): Likewise.
* match.c (LOG_MATCH, LOG_MISMATCH, do_txeval): Likewise.
* parser.c (regex_parse, lisp_parse_impl, find_matching_syms):
Likewise.
* stream.c (do_parse_mode): Likewise.
* txr.c (sysroot_init): Likewise.
(txr_main): Replace string(L"") with null_string.
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | lib.c | 2 | ||||
-rw-r--r-- | match.c | 6 | ||||
-rw-r--r-- | parser.c | 7 | ||||
-rw-r--r-- | stream.c | 2 | ||||
-rw-r--r-- | txr.c | 4 |
6 files changed, 12 insertions, 11 deletions
@@ -4663,7 +4663,7 @@ val load(val target) open_txr_file(path, &txr_lisp_p, &name, &stream, self); - if (match_str(or2(get_line(stream), lit("")), lit("#!"), nil)) + if (match_str(or2(get_line(stream), null_string), lit("#!"), nil)) parser_set_lineno(self, stream, two); else seek_stream(stream, zero, from_start_k); @@ -13166,7 +13166,7 @@ static void obj_init(void) args_k = intern(lit("args"), keyword_package); nothrow_k = intern(lit("nothrow"), keyword_package); - colon_k = intern(lit(""), keyword_package); + colon_k = intern(null_string, keyword_package); auto_k = intern(lit("auto"), keyword_package); fun_k = intern(lit("fun"), keyword_package); wrap_k = intern(lit("wrap"), keyword_package); @@ -519,14 +519,14 @@ typedef val (*h_match_func)(match_line_ctx *c); plus(c->pos, c->base), c->file, c->data_lineno, nao); \ debuglf(elem, lit(" ~a"), c->dataline, nao); \ if (c_num(c->pos, lit("txr")) < 77) \ - debuglf(elem, lit(" ~*a^"), c->pos, lit(""), nao) + debuglf(elem, lit(" ~*a^"), c->pos, null_string, nao) #define LOG_MATCH(KIND, EXTENT) \ debuglf(elem, lit(KIND " matched, position ~a-~a (~a:~d)"), \ plus(c->pos, c->base), EXTENT, c->file, c->data_lineno, nao); \ debuglf(elem, lit(" ~a"), c->dataline, nao); \ if (c_num(EXTENT, lit("txr")) < 77) \ - debuglf(elem, lit(" ~*a~<*a^"), c->pos, lit(""), \ + debuglf(elem, lit(" ~*a~<*a^"), c->pos, null_string, \ minus(EXTENT, c->pos), lit("^"), nao) #define elem_bind(elem_var, directive_var, specline) \ @@ -2005,7 +2005,7 @@ static val do_txeval(val spec, val form, val bindings, val allow_unbound) uw_catch (exc_sym, exc) { val msg = if3(consp(exc), car(exc), exc); - if (stringp(msg) && !equal(msg, lit("")) && + if (stringp(msg) && !equal(msg, null_string) && chr_str(msg, zero) == chr('(')) { uw_throw (exc_sym, exc); @@ -620,7 +620,8 @@ val regex_parse(val string, val error_stream) { int gc = gc_state(0); - parse(&parser, if3(std_error != std_null, lit("regex"), lit("")), prime_regex); + parse(&parser, if3(std_error != std_null, lit("regex"), null_string), + prime_regex); gc_state(gc); } @@ -668,7 +669,7 @@ static val lisp_parse_impl(val self, enum prime_parser prime, for (;;) { int gc = gc_state(0); - parse(pi, if3(std_error != std_null, name, lit("")), prime); + parse(pi, if3(std_error != std_null, name, null_string), prime); mut(parser); gc_state(gc); @@ -962,7 +963,7 @@ static void find_matching_syms(lino_completions_t *cpl, val qualify = tnil(force_qualify || !is_cur); val pkg_name = if2(qualify, if3(package == keyword_package && !force_qualify, - lit(""), + null_string, package_name(package))); val syms = ((kind == 'S' || kind == 'M') ? hash_keys((get_slot_syms(package, is_cur, tnil(kind == 'M')))) @@ -1443,7 +1443,7 @@ static struct stdio_mode do_parse_mode(val mode_str, struct stdio_mode m_dfl, val self) { struct stdio_mode m = stdio_mode_init_blank; - const wchar_t *ms = c_str(default_arg_strict(mode_str, lit("")), self); + const wchar_t *ms = c_str(default_arg_strict(mode_str, null_string), self); int nredir = 0; switch (*ms) { @@ -329,7 +329,7 @@ static void sysroot_init(void) prog_dir = dir_name(prog_path); if (ref(prog_dir, negone) != chr(psc[0])) - prog_dir = scat3(prog_dir, chr(psc[0]), lit("")); + prog_dir = scat3(prog_dir, chr(psc[0]), null_string); if (!(maybe_sysroot(lit(TXR_REL_PATH)) || maybe_sysroot(lit(TXR_REL_PATH EXE_SUFF)) || @@ -668,7 +668,7 @@ int txr_main(int argc, char **argv) else if (deflist) bindings = cons(cons(sym, car(deflist)), bindings); else - bindings = cons(cons(sym, string(L"")), bindings); + bindings = cons(cons(sym, null_string), bindings); match_reg_var(sym); |